United States    
COMPAQ STORE | PRODUCTS |
SERVICES | SUPPORT | CONTACT US | SEARCH
Compaq C

Compaq C
User's Guide for OpenVMS Systems


Previous Contents Index

For OpenVMS Alpha systems the default, /OPTIMIZE, is equivalent to /OPTIMIZE=(INLINE=AUTOMATIC,LEVEL=4,UNROLL=0,TUNE=GENERIC).

Use /NOOPTIMIZE or /OPTIMIZE=LEVEL=0 (ALPHA ONLY) for a debugging session to ensure that the debugger has sufficient information to locate errors in the source program.

In most cases, using /OPTIMIZE will make the program execute faster. As a side effect of getting the fastest execution speeds, using /OPTIMIZE can produce larger object modules and longer compile times than /NOOPTIMIZE.

Loop Unrolling (ALPHA ONLY)

At optimization level 3 or above, Compaq C attempts to unroll certain loops to minimize the number of branches and group more instructions together to allow efficient overlapped instruction execution (instruction pipelining). The best candidates for loop unrolling are innermost loops with limited control flow.

As more loops are unrolled, the average size of basic blocks increases. Loop unrolling generates multiple loop code iterations in a manner that allows efficient instruction pipelining.

The loop body is replicated a certain number of times, substituting index expressions. An initialization loop may be created to align the first reference with the main series of loops. A remainder loop may be created for leftover work.

The number of times a loop is unrolled can be determined by the optimizer or the user can specify the limit for loop unrolling using the /OPTIMIZE=UNROLL qualifier. Unless the user specifies a value, the optimizer unrolls a loop 4 times for most loops or 2 times for certain loops (large estimated code size or branches out the loop).

Software Pipelining (ALPHA ONLY)

Software pipelining and additional software dependence analysis are enabled by using /OPTIMIZE=LEVEL=5, which in certain cases improves run-time performance.

Loop unrolling (enabled at /OPTIMIZE=LEVEL=3 or higher) is constrained in that it cannot schedule across iterations of a loop. Because software pipelining can schedule across loop iterations, it can perform more efficient scheduling that eliminates instruction stalls within loops, by rearranging instructions between different unrolled loop iterations to improve performance.

For example, if software dependence analysis of data flow reveals that certain calculations can be done before or after that iteration of the unrolled loop, software pipelining reschedules those instructions ahead of or behind that loop iteration, at places where their execution can prevent instruction stalls or otherwise improve performance.

Loops chosen for software pipelining:

By modifying the unrolled loop and inserting instructions as needed before and/or after the unrolled loop, software pipelining generally improves run-time performance, except for cases where the loops contain a large number of instructions with many existing overlapped operations. In this case, software pipelining may not have enough registers available to effectively improve execution performance, and run-time performance using level 5 may not improve as compared to using level 4.

To determine whether using level 5 benefits your particular program, time program execution for the same program compiled at levels 4 and 5. For programs that contain loops that exhaust available registers, longer execution times may result with level 5.

In cases where performance does not improve, consider compiling using /OPTIMIZE=(UNROLL=1, LEVEL=5) to possibly improve the effects of software pipelining.

/PDSC_MASK=option (ALPHA ONLY)

Forces the compiler to set the PDSC$V_EXCEPTION_MODE field of the procedure descriptor for each function in the compilation unit to the specified value, regardless of the setting of any other qualifiers.

Ordinarily the PDSC$V_EXCEPTION_MODE field gets set automatically by the compiler, depending on the /IEEE_MODE qualifier setting. The /PDSC_MASK qualifier overrides the /IEEE_MODE qualifier setting of this field.

Note

This qualifier is a low-level systems-programming feature that is seldom necessary. Its usage can produce object modules that do not conform to the VMS common language environment and, within C, it can produce nonstandard and seemingly incorrect floating-point behaviors at runtime.

As shown in Table 1-16, the qualifier option keywords are exactly the allowed values defined in the OpenVMS Calling Standard for this field, stripped of the PDSC$V_EXCEPTION_MODE prefix (for example, /PDSC_MASK=SIGNAL sets the field to PDSC$V_EXCEPTION_MODE_SIGNAL).

Table 1-16 /PDSC_MASK Qualifier Options
Option Maps to Meaning
SIGNAL PDSC$K_EXCEPTION_MODE_SIGNAL Raise exceptions for all except underflow (which is flushed to 0).
SIGNAL_ALL PDSC$K_EXCEPTION_MODE_SIGNAL_ALL Raise exceptions for all.
SILENT PDSC$K_EXCEPTION_MODE_SILENT Raise no exceptions. Create only finite values: no infinities, no denorms, no NaNs.
FULL_IEEE PDSC$K_EXCEPTION_MODE_FULL_IEEE Raise no exceptions except as controlled by separate IEEE exception-enabling bits. Create exceptional values according to the IEEE standard.
CALLER PDSC$K_EXCEPTION_MODE_CALLER Emulate the same mode as the caller. This is useful primarily for writing libraries that can be called from languages other than C.

In the absence of the /PDSC_MASK qualifier, the compiler sets the PDSC$V_EXCEPTION_MODE field automatically, depending on the /IEEE_MODE qualifier setting:

/[NO]PLUS_LIST_OPTIMIZE (ALPHA ONLY)

Provides improved optimization and code generation across file boundaries that would not be available if the files were compiled separately.

When you specify /PLUS_LIST_OPTIMIZE on the command line in conjunction with a series of file specifications separated by plus signs, the compiler does not concatenate each of the specified source files together; such concatenation is generally not correct for C code because a C source file defines a scope.

Instead, each file is treated separately for purposes of parsing, except that the compiler issues diagnostics about conflicting external declarations and function definitions that occur in different files. For purposes of code generation, the compiler treats the files as one application and can perform optimizations across the source files.

The default is /NOPLUS_LIST_OPTIMIZE.

/[NO]POINTER_SIZE=option (ALPHA ONLY)

Controls whether or not pointer-size features are enabled and whether pointers are 32-bits or 64 bits.

The default is /NOPOINTER_SIZE, which disables pointer-size features, such as the ability to use #pragma pointer_size , and directs the compiler to assume that all pointers are 32-bit pointers. This default represents no change over previous versions of Compaq C.

Table 1-17 shows the /POINTER_SIZE qualifier options.

Table 1-17 /POINTER_SIZE Qualifier Options
Option Usage
{SHORT|32} The compiler assumes 32-bit pointers.
{LONG|64} The compiler assumes 64-bit pointers.

Specifying /POINTER_SIZE=32 enables pointer-size features and directs the compiler to assume that all pointers are 32-bit pointers.

Specifying /POINTER_SIZE=64 enables pointer-size features and directs the compiler to assume that all pointers are 64-bit pointers.

Specifying /POINTER_SIZE enables the following pointer-size features:

For information about other compiler features that affect pointer size or warn about potential pointer size conflicts, see the following:

The /POINTER_SIZE qualifier must be specified for any program that uses 64-bit pointers.

/PRECISION[=option]

Controls whether floating-point operations on float variables are performed in single or double precision. Table 1-18 shows the /PRECISION qualifier options.

Table 1-18 /PRECISION Qualifier Options
Option Usage
SINGLE Performs floating-point operations in single precision.
DOUBLE Performs floating-point operations in double precision.

Your code may execute faster if it contains float variables and is compiled with /PRECISION=SINGLE. However, the results of your floating-point operations will be less precise. See the Compaq C Language Reference Manual for more information on floating-point variables.

The default is /PRECISION=DOUBLE for /STANDARD=VAXC and /STANDARD=COMMON compiler modes.

The default is /PRECISION=SINGLE for /STANDARD=ANSI89 and /STANDARD=RELAXED_ANSI89 compiler modes.

/[NO]PREFIX_LIBRARY_ENTRIES[=(option[,...])]

The Compaq C Run-Time Library (RTL) shareable image, DECC$SHR.EXE, resides in SYS$LIBRARY with a DECC$ prefix for its entry points. The linker searches IMAGELIB.OLB to locate the shareable image. Every external name in IMAGELIB.OLB has a DECC$ prefix, and, therefore, has an OpenVMS conformant name space (a requirement for inclusion in IMAGELIB).

The /[NO]PREFIX_LIBRARY_ENTRIES qualifier lets you control the Compaq C RTL name prefixing. Table 1-19 describes the /PREFIX_LIBRARY_ENTRIES qualifier options.

Table 1-19 /PREFIX_LIBRARY_ENTRIES Qualifier Options
Option Usage
EXCEPT = ( name,...) The names specified are not prefixed.
ALL_ENTRIES All Compaq C RTL names are prefixed.
ANSI_C89_ENTRIES Only ANSI C library names are prefixed.
RTL=" name" Generates references to the C RTL indicated by the name keyword. (The name keyword has a length limit of 24 characters for OpenVMS VAX systems and 1017 characters for OpenVMS Alpha systems.) If no keyword is specified, then references to the Compaq C RTL are generated by default. To use an alternate RTL, see its documentation for the name to use.

If you want no names prefixed, specify /NOPREFIX_LIBRARY_ENTRIES.

The defaults on both Alpha and VAX systems are:

/[NO]PREPROCESS_ONLY[=filename]

Gives the same functionality as the -e qualifier on UNIX C compilers. When specified, it performs only the actions of the preprocessor phase and writes the resulting processed text to a file. No semantic or syntax processing is done. Furthermore, no object file, diagnostic file, listing file, or analysis data file is produced.

If you do not specify a file name for the preprocessor output, the name of the output file defaults to the file name of the input file with a .I file type.

The default is /NOPREPROCESS_ONLY.

/[NO]PROTOTYPE[=(option[,...])]

Creates an output file containing function prototypes for all global functions defined in the module being compiled.

ANSI-style prototypes are created even for functions defined with Kernighan and Ritchie style syntax.

This qualifier can be used to convert to ANSI-sytle prototypes or just to ensure that every function definition has a compatible explicit declaration, thereby avoiding implicit declarations that can sometimes produce surprising results.

Table 1-20 describes the /FLOAT qualifier options.

Table 1-20 /PROTOTYPE Qualifier Options
Option Usage
[NO]IDENTIFIERS Indicates that identifier names are to be included in the prototype declarations that appear in the output file. The default is NOIDENTIFIERS.
[NO]STATIC_FUNCTIONS Indicates that prototypes for static function definitions are to be included in the output file. The default is NOSTATIC_FUNCTIONS.
FILE= filename Specifies the output file name. When not specified, the output file name has the same defaults as the listing file, except that the file extension is .CH instead of .LIS.

The default is /NOPROTOTYPES.

/PSECT_MODEL=[NO]MULTILANGUAGE (ALPHA ONLY)

Controls whether the compiler allocates the size of overlaid psects to ensure compatibility when the psect is shared by code created by other DIGITAL compilers.

The problem this switch solves can occur when a psect generated by a FORTRAN COMMON block is overlaid with a psect consisting of a C struct. Because FORTRAN COMMON blocks are not padded, if the C struct is padded, the inconsistent psect sizes can cause linker error messages.

Compiling with /PSECT_MODEL=MULTILANGUAGE ensures that Compaq C uses a consistent psect size allocation scheme. The corresponding FORTRAN switch is /ALIGN=COMMON=[NO]MULTILANGUAGE.

The default is /PSECT=NOMULTILANGUAGE, which is the old default behavior of the compiler, and is sufficient for most applications.

/REENTRANCY=option (ALPHA ONLY)

Controls the type of reentrancy that reentrant Compaq C RTL routines will exhibit. (See the decc$set_reentrancy RTL routine.)

This qualifier is for use only with a module containing the main routine.

The reentrancy level is set at run time according to the /REENTRANCY qualifier specified while compiling the module containing the main routine.

Table 1-21 describes the /REENTRANCY qualifier options.

Table 1-21 /REENTRANCY Qualifier Options
Option Usage
AST Uses the __TESTBITSSI built-in function to perform simple locking around critical sections of RTL code, and may additionally disable asynchronous system traps (ASTs) in locked region of codes. This type of locking should be used when AST code contains calls to Compaq C RTL I/O routines.
MULTITHREAD Designed to be used in conjunction with the DECthreads product. It performs DECthreads locking and never disables ASTs.
NONE Gives optimal performance in the RTL, but does absolutely no locking around critical sections of RTL code. It should only be used in a single threaded environment when there is no chance that the thread of execution will be interrupted by an AST that would call the Compaq C RTL.
TOLERANT Uses the __TESTBITSSI built-in function to perform simple locking around critical sections of RTL code, but ASTs are not disabled. This type of locking should be used when ASTs are used and must be delivered immediately.

The default is /REENTRANCY=TOLERANT.

/REPOSITORY=option

Specifies a repository for the compiler to store shortened external name information. When /NAMES=SHORTENED is specified, the compiler stores to the repository any external names that were shortened. The demangler utility can then be used to map the shortened names back to the names used in the original C program.

By default, the qualifier is not active unless /NAMES=SHORTENED has been specified, in which case the default is /REPOSITORY=[.CXX_REPOSITORY].

The default name of the repository is the same as that used by the DIGITAL C++ compiler for decoding mangled names. This is intentional. A C++ mangled name cannot match a shortened name, so a single repository can be used by both the Compaq C and DIGITAL C++ compilers.

/ROUNDING_MODE=option (ALPHA ONLY)

If /FLOAT=IEEE_MODE is specified, the /ROUNDING_MODE qualifier lets you select one of the following IEEE rounding modes:
Option Usage
NEAREST Sets the normal rounding mode (unbiased round to nearest). This is the default.
DYNAMIC Sets the rounding mode for IEEE floating-point instructions dynamically, as determined from the contents of the floating-point control register.
MINUS_INFINITY Rounds toward minus infinity.
CHOPPED Rounds toward 0.

If /FLOAT=G_FLOAT or /FLOAT=D_FLOAT is specified, then rounding defaults to /ROUNDING_MODE=NEAREST, with no other choice of rounding mode.

/[NO]SHARE_GLOBALS

Controls whether the compiler will treat declarations of objects with the globaldef keyword as shared or not shared.

Also, in conjunction with the /EXTERN_MODEL qualifier, controls whether the initial extern_model is shared or not shared (for those extern_model s where it is allowed). The initial extern_model of the compiler is a fictitious pragma constructed from the settings of the /EXTERN_MODEL and /SHARE_GLOBALS qualifiers.

The default value is /NOSHARE_GLOBALS. This default value is different from VAX C, which treats external objects as shared by default. As a result, you may experience the following impact:

/SHOW[=(option[,...])]

Sets or cancels listing options. You must use the /LIST qualifier with the /SHOW qualifier to use any of the /SHOW options. Table 1-22 describes the /SHOW qualifier options.

Table 1-22 /SHOW Qualifier Options
Option Usage
ALL Prints all listing information.
[NO]BRIEF Creates the same listing as the option SYMBOLS except that BRIEF eliminates from the list any identifiers that are not referenced in the program, and are not members of a structure or union that is referenced in the program.

The NOBRIEF option is the default.

[NO]CROSS_REFERENCE Specifies whether the compiler generates cross-references. If you specify /SHOW=CROSS_REFERENCE, the compiler lists, for each variable referenced in the procedure, the line numbers of the lines on which the variable is referenced.

You may use /SHOW=CROSS_REFERENCE with /SHOW=SYMBOLS. Otherwise, specifying /SHOW=CROSS_REFERENCE also gives you /SHOW=BRIEF. To obtain any type of listing, you must specify /LIST. Specifying /SHOW=[NO]CROSS_REFERENCE is the same as specifying /[NO]CROSS_REFERENCE.

The NOCROSS_REFERENCE option is the default.

[NO]DICTIONARY Places CDD/Repository definitions---included in the program with the #pragma dictionary preprocessor directive---into the listing file. These data definitions are marked in the listing file with an uppercase letter D in the listing margin.

The NODICTIONARY option is the default.

[NO]EXPANSION Places final macro expansions in the program listing. However, expansion text for preprocessing directives is not shown. When you specify this option, the number printed in the margin indicates the maximum depth of macro substitutions that occur on each line.

The NOEXPANSION option is the default.

[NO]HEADER Produces the header lines at the top of each page of a listing.

The HEADER option is the default.

[NO]INCLUDE Places the contents of #include files and modules in the program listing.

The NOINCLUDE option is the default.

[NO]INTERMEDIATE (VAX ONLY) Places all intermediate and final macro expansions in the program listing.

The NOINTERMEDIATE option is the default.

[NO]MESSAGES Lists all messages that are in effect at compilation (based on the settings of /STANDARD, /WARNINGS, and #pragma message).

The NOMESSAGE option is the default.

NONE Creates an empty listing file with only the header. If you specify this option on a CC command line that contains /LIST and /MACHINE_CODE, the compiler places machine code in the listing file.
[NO]SOURCE Places the source program statements in the program listing.

The SOURCE option is the default.

[NO]STATISTICS Places compiler performance statistics in the program listing.

The NOSTATISTICS option is the default.

[NO]SYMBOLS Places the symbol table of the compiled program in the program listing. The symbol table includes a list of all functions, the sizes and attributes of all variables referenced in the program, and a program section summary and function definition map.

The NOSYMBOLS option is the default.

[NO]TERMINAL (VAX ONLY) Displays compiler messages to the terminal. Use /SHOW=NOTERMINAL to suppress compiler messages to the terminal or to a batch log file.

The TERMINAL option is the default.

[NO]TRANSLATION (VAX ONLY) Places into the listing file all UNIX system file specifications that the compiler translates to OpenVMS file specifications. See the Compaq C Run-Time Library Reference Manual for OpenVMS Systems for more information on file translation.

The NOTRANSLATION option is the default.

/[NO]STANDARD[=(option[,...])]

Defines the compilation mode. Table 1-23 describes the /STANDARD qualifier options.

Table 1-23 /STANDARD Qualifier Options
Option Usage
ANSI89 Places the compiler in strict ANSI C Standard mode.
RELAXED_ANSI89 Places the compiler in relaxed ANSI C Standard mode.
MS Interprets source programs according to certain language rules followed by Microsoft's Visual C++ compiler.
ISOC94 Places the compiler in ISO C 94 mode, which enables digraph processing and defines the macro __stdc_version__=199409l .

Digraphs are pairs of characters that translate into a single character, much like trigraphs, except that trigraphs get replaced inside string literals, but digraphs do not. The digraphs are:
Digraph Character Represented
<: [
:> ]
<% {
%> }
%: #
%:%: ##

The ISOC94 option can be specified alone or in combination with any other option except VAXC. If specified alone, ISOC94 provides a default major mode of RELAXED_ANSI89.

COMMON Places the compiler in common C mode.
VAXC Places the compiler in VAX C mode.
PORTABLE Places the compiler in RELAXED_ANSI89 mode, and enables the issuance of diagnostics that warn about any nonportable usages encountered.

/STANDARD=PORTABLE is supported for VAX C compatibility only. It is equivalent to the recommended combination of qualifiers /STANDARD=RELAXED_ANSI89 /WARNINGS=ENABLE=PORTABLE.

MIA Places the compiler in strict ANSI C Standard mode with some behavior differences, as required by the MIA standard:
  • On OpenVMS VAX systems, G_floating becomes the default floating-point format for double variables. (VAX ONLY)

    On OpenVMS Alpha systems, G_floating is the default in any case.

  • In structures, zero-length bit fields cause the next bit field to start on an integer boundary, rather than on a character boundary.

Compiling a program with /STANDARD=MIA sets the __mia predefined macro to 1.


Previous Next Contents Index
  

1.800.AT.COMPAQ

privacy and legal statement