United States |
![]() |
![]() |
|
Order Number: AA--PUNZK--TK
This guide describes using the Compaq C compiler on OpenVMS systems. It contains information on Compaq C program development in the OpenVMS environment, Compaq C features specific to OpenVMS systems, and cross-system portability concerns.
Revision/Update Information:
This revised guide supersedes the
DEC C User's Guide for OpenVMS Systems (Order No.
AA--PUNZJ--TK)
Software Version: Compaq C Version 6.4 for OpenVMS Systems
Compaq Computer Corporation
Houston, Texas
© 2001 Compaq Computer Corporation.
COMPAQ, the Compaq logo, VAX, Alpha, VMS, and OpenVMS are registered in the U.S. Patent and Trademark Office. Tru64 is a trademark of Compaq Information Technologies Group, L.P. in the United States and other countries. Microsoft and Visual C++ are trademarks of Microsoft Corporation. UNIX is a trademark of The Open Group in the United States and other countries. All other product names mentioned herein may be trademarks of their respective companies.
Confidential computer software. Valid license from Compaq required for possession, use, or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.
Compaq shall not be liable for technical or editorial errors or omissions contained herein. The information in this document is provided as is without warranty of any kind and is subject to change without notice. The warranties for Compaq products are set forth in the express limited warranty statements accompanying such products. Nothing herein should be construed as constituting an additional warranty.
This document is available on CD-ROM.
This document was prepared using DECdocument, Version V3.3-1e.
Contents | Index |
This guide contains the information necessary for developing and debugging Compaq C (formerly DEC C) programs on the OpenVMS operating system. Compaq C is compliant with the International Standards Organization (ISO) C Standard (ISO 9899:1990[1992]), formerly the American National Standard for Information (ANSI) Systems-Programming Language C (document number: X3.159-1989), called the ANSI C Standard in this guide. Compaq C is an ANSI compliant C compiler for the OpenVMS operating system on VAX and Alpha processors and for the Tru64 UNIX® operating system on Alpha processors. Through use of command-line options, Compaq C is compatible with older dialects of C, including common usage C and VAX C.
This guide also includes Compaq C language features specific to OpenVMS systems, as well as information about porting C programs to and from OpenVMS and other operating systems. For more information about porting programs to and from other operating systems, see the Compaq C Run-Time Library Reference Manual for OpenVMS Systems.
You may send comments or suggestions regarding this guide or any Compaq C document by sending electronic mail to the following Internet address:
c_docs@compaq.com
This guide is intended for experienced programmers who need to develop Compaq C programs on OpenVMS systems, for users who need to know the difference between Compaq C and other implementations, and for experienced C users who need to reference language information specific to OpenVMS systems. You should be familiar with one high-level language and should have some familiarity with the DIGITAL Command Language (DCL). If you are not familiar with or need to reference information about the DCL, see Chapter 1.
This guide has the following chapters and appendixes:
You may find the following documents useful when programming in Compaq C:
1 Brian W. Kernighan and Dennis M. Ritchie, The C Programming Language, Second Edition (Englewood Cliffs, New Jersey: Prentice Hall, 1988). |
Table 1 lists the conventions used in this guide.
Convention | Meaning |
---|---|
[Return] | The symbol [Return] represents a single stroke of the Return key on a terminal. |
Ctrl/X | The symbol Ctrl/X, where the letter X represents a terminal control character, is generated by holding down the Ctrl key while pressing the key of the specified terminal character. |
switch
statement
fprintf function auto storage class |
In syntax definitions, items appearing in monospaced type identify language keywords and the names of OpenVMS and Compaq C Run-Time Library functions. |
arg1 | Italic type indicates a placeholder, such as an argument or parameter name, and the introduction of new terms. |
$ RUN CPROG [Return] | Interactive examples show user input in boldface type. |
float x;
. . . x = 5; |
A vertical ellipsis indicates that not all of the text of a program or program output is illustrated. Only relevant material is shown in the example. |
option,... | A horizontal ellipsis indicates that additional parameters, options, or values can be entered. A comma that precedes the ellipsis indicates that successive items must be separated by commas. |
[output-source,...] | Square brackets, in function synopses and a few other contexts, indicate that a syntactic element is optional. Square brackets are not optional, however, when used to delimit a directory name in an OpenVMS file specification or when used to delimit the dimensions of an array in Compaq C source code. |
sc-specifier ::=
auto static [extern] register |
In syntax definitions, items appearing on separate lines are mutually exclusive alternatives. |
{a|b} | Braces surrounding two or more items separated by a vertical bar (|) indicate a choice; you must choose one of the two syntactic elements. |
<ucDelta symbol> | A delta symbol is used in some contexts to indicate a single ASCII space character. |
A platform is a combination of operating system and hardware that provides a distinct environment. This guide contains information applicable to the OpenVMS operating system on both the VAX and Alpha architectures.
The information in this guide applies to both of these platforms, except when specifically labeled, as follows:
Label | Explanation |
---|---|
(ALPHA ONLY) | Specific to an Alpha processor running the OpenVMS operating system. |
(VAX ONLY) | Specific to a VAX processor running the OpenVMS operating system. |
Compaq C Version 6.4 provides most of the language-feature support for the new C99 standard (ISO/IEC 9899:1999 published by ISO in December, 1999 and adopted as an ANSI standard in April, 2000). See the Compaq C Language Reference Manual for more information on these language features.
This version also adds new command-line options and pragmas, and a new version of the GEM optimizing back end for Alpha systems.
Specific new features of this release include:
NOC89 - features not in C89
NOC99 - features not in C99
NEWC99 - features that are new in C99
__STDC_HOSTED__ (defined with the value 1)
__STDC_VERSION__ (defined with the value 199901L)
__STDC_ISO_10646 (defined with the value 199712L)
This field-test version of the User's Guide does not necessarily reflect inclusion of all new features for Version 6.4 of the compiler. Conversely, some documented features might not be available at field test, but will be supported at final product release. Please see the Compaq C release notes for a comprehensive list of enhancements and fixes available for field test. |
This chapter describes the following information about developing Compaq C programs on an OpenVMS system:
This section provides a brief overview of the DCL commands used for program development. The following sections provide more detailed information about these topics.
Figure 1-1 shows the basic steps in Compaq C program development.
Figure 1-1 DCL Commands for Developing Programs
To create a Compaq C source program at DCL level, you must invoke a text editor. In Figure 1-1, the EDIT command invokes the default editor EDT to create the source program AVERAGE.C. You can use another editor, such as the OpenVMS Text Processing Utility (TPU) or the Compaq Language-Sensitive Editor (LSE). (LSE is a product that must be purchased separately; see Appendix C for more information.) A file type of C is used to indicate that you are creating a Compaq C source program. C is the conventional file type for all Compaq C source programs.
When you compile your program with the CC command, you do not have to specify the file type; by default, Compaq C searches for files with a file type of C.
If your source program compiles successfully, the Compaq C compiler creates an object file with the file type OBJ.
However, if the Compaq C compiler detects errors in your source program, the system displays each error on your screen and then displays the DCL prompt. You can then reinvoke your text editor to correct each error.
You can specify command qualifiers on the CC command. Command qualifiers cause the Compaq C compiler to perform additional actions. In the following example, the /LIST qualifier causes the Compaq C compiler to produce the listing file AVERAGE.LIS:
$ CC/LIST AVERAGE |
For a complete description of all CC command qualifiers, see Section 1.3.4.
After your program has compiled successfully, invoke the OpenVMS Linker to create an executable image file. For example:
$ LINK AVERAGE |
The linker uses the object file produced by Compaq C as input to produce an executable image file as output. (The executable image is a file containing program code that can be run on the system.)
You can specify command qualifiers with the DCL command LINK. For a complete list and explanation of all the command qualifiers available with the LINK command, see Section 1.4.2.
After producing the executable image file, use the RUN command to
execute your program.
1.2 Creating a Compaq C Program
To create and modify a Compaq C program, you must invoke a text
editor. The OpenVMS system provides you with two text editors:
EDT and the OpenVMS Text Processing Utility (TPU). The
following section discusses TPU. See the OpenVMS EDT Reference Manual for more
information on EDT.
1.2.1 Using TPU
TPU is a high-performance, programmable utility. It provides two editing interfaces: the Extensible VAX Editor (EVE), described in the following section, and the TPU EDT Keypad Emulator. You can also create your own interfaces.
Like EDT, TPU provides you with an online help facility that you can access during your editing session. When you invoke TPU to create a file, a journal file is automatically created. You can use this journal file to recover your edits if the system fails during an editing session. To recover your edits, enter the EVE/RECOVER command.
Unlike EDT, TPU provides multiple windows. This feature allows you to
view two files on your screen at the same time.
1.2.2 The EVE Interface to TPU
EVE is an interactive text editor that allows you to execute common editing functions using the EVE keypad or to execute more advanced functions by entering commands on the EVE command line. The following command line invokes the EVE editor and creates the file PROG_1.C:
$ EDIT/TPU PROG_1.C |
You can define a global symbol for the EDIT/TPU command by placing a symbol definition in your LOGIN.COM file. For example:
$ EVE == "EDIT/TPU" |
After this command line is executed, you can type EVE at the DCL prompt followed by the name of the file you want to modify or create.
For more information on using EVE, see the Guide to VMS Text Processing.
1.3 Compiling a Compaq C Program
The Compaq C compiler performs the following functions:
The following sections discuss the CC command and its qualifiers.
Next | Contents | Index |
|