United States |
Previous | Contents | Index |
The Standard specifies that each enumerated type be compatible with an
implementation-defined integer type. In Compaq C, each enumerated
type is compatible with the
signed int
type.
B.31 Type Qualifiers (§3.5.3)
The
volatile
storage class is specified for those variables that can be modified in
ways unknown to the compiler. Thus, if an object is declared volatile,
every reference to the object in the source code results in a reference
to memory in the object code.
B.32 Declarators (§3.5.4)
There is no internal limit on the number of pointer, function or array
declarators that can modify an arithmetic, structure, union, or
incomplete type.
B.33 Initialization (§3.5.7)
C allows initializers to be optionally surrounded by braces ( { } )
when they are not logically necessary. This has resulted in aggregate
initializers with partially ignored braces that are parsed differently
depending on the type of parser implemented (bottom-up or top-down).
The Standard has specified the top-down parse originally specified in
Kernighan and Ritchie's The C Programming Language. Programs
depending on a bottom-up parse (common C parse) of partially braced
initializers can yield unexpected results. Even though this construct
is allowed, a warning message is given to inform the user of ignored
braces when in common C mode or if using the check option.
B.34 The switch Statement (§3.6.4.2)
There is no limit on the number of
case
labels in a
switch
statement.
B.35 External Object Definitions (§3.7.2)
In common C mode, all
extern
objects have file scope.
B.36 Conditional Inclusion (§3.8.1)
Previous preprocessors have allowed extraneous text after a preprocessor directive. For example:
#endif system1 |
However, the Standard has stated that the only text allowed after a preprocessing directive is a comment. Therefore, the Compaq C compiler issues a warning message if this syntax rule is violated.
The numeric value for character constants within
#if
and
#elif
directives matches the value obtained when an identical character
constant occurs in expressions that are not part of these directives.
B.37 Source File Inclusion (§3.8.2)
Source files can be included using either a quoted path name (
#include "stdio.h"
) or bracketed path names (
#include <stdio.h>
). OpenVMS systems also support a method of including modules
from a text library.
See your platform-specific Compaq C documentation for the
search-path algorithm for including source files.
B.38 Macro Replacement---Predefined Macro Names (§3.8.3)
In addition to the predefined macro names defined in the Standard, the Compaq C compiler defines other preprocessor macros for various identification purposes. When the compiler is invoked, the appropriate identification macros are defined depending on the operating system, architecture, language, compiler mode, and other environment variables. You can reference these macros in #ifdef preprocessor directives to isolate code that applies to a particular environment.
Each Compaq C platform can have additional predefined macros. See your platform-specific Compaq C documentation for more information.
Table B-1 shows the predefined macro names for Tru64 UNIX.
Macro Name | |
---|---|
Operating system name: | unix |
__unix__ | |
__osf | |
SYSTYPE_BSD | |
_SYSTYPE_BSD | |
Architecture name: | __alpha |
Product name: | __DECC |
__DECC_VER | |
LANGUAGE_C | |
__LANGUAGE_C__ |
Table B-2 shows the predefined macro names for OpenVMS VAX and Alpha systems. All forms are defined unless strict ANSI mode is in effect, in which case only the new spellings are defined.
New Spelling | Traditional Spelling | |
---|---|---|
Operating system name: | __vms | vms |
__VMS | VMS | |
__vms_version | vms_version | |
__VMS_VERSION | VMS_VERSION | |
Architecture name: | __vax (VAX) | vax (VAX) |
__VAX (VAX) | VAX (VAX) | |
__alpha (ALPHA) | --- | |
__ALPHA (ALPHA) | --- | |
__Alpha_AXP (ALPHA) | --- | |
__32BITS (ALPHA) | --- | |
Product name: | __vaxc | vaxc |
__VAXC | VAXC | |
__vax11c | vax11c | |
__VAX11C | VAX11C | |
__STDC__ | --- | |
__DECC | --- | |
__DECC_VER | --- | |
__VMS_V6_RTL_COMPAT | -- | |
Compiler Mode: | __DECC_MODE_STRICT | -- |
__DECC_MODE_RELAXED | -- | |
__DECC_MODE_VAXC | -- | |
__DECC_MODE_COMMON | -- | |
Floating-Point: | __D_FLOAT | -- |
__G_FLOAT | -- | |
__IEEE_FLOAT (ALPHA) | -- | |
__X_FLOAT (ALPHA) | -- | |
Other: | __HIDE_FORBIDDEN_NAMES | -- |
__INITIAL_POINTER_SIZE (ALPHA) | -- |
You can explicitly define the macros in Table B-3 to control which C library routines are declared in header files and to obtain standards conformance checking. To define these macros use one of the following:
Macro | Standard |
---|---|
_XOPEN_SOURCE_EXTENDED | XPG4-UNIX |
_XOPEN_SOURCE | XPG4 |
_POSIX_C_SOURCE | POSIX |
_ANSI_C_SOURCE | ISO C and ANSI C |
_AES_SOURCE (TRU64 UNIX) | Application Environment Services |
_OSF_SOURCE (TRU64 UNIX) | OSF compatibility |
_VMS_V6_SOURCE (OPENVMS) | OpenVMS Version 6 compatibility |
_DECC_V4_SOURCE (OPENVMS) | DEC C Version 4 compatibility |
The ## operator within a macro replacement list causes the two tokens on either side of the operator to be concatenated into a single token.
In common C and VAX C compatibility mode, comments can also concatenate two tokens because in these modes a comment is replaced by a null string after macro invocations.
This behavior is not supported in strict ANSI or default mode, where
comments are replaced with a single space.
B.40 Error Directive (§3.8.5)
The
#error
directive causes an error message to be issued and the compilation to
cease.
B.41 Pragma Directive (§3.8.6)
The Standard's approved method of adding extensions to the language is through the addition of pragmas. All unrecognized pragmas are diagnosed with an informational message. Supported pragmas vary across platforms. See your platform-specific Compaq C documentation for more information.
When only preprocessing a file, all pragmas recognized by Compaq C
are written unaltered to the output.
B.42 Function Inline Expansion
Function inline expansion eliminates procedure-call overhead and allows general optimization methods to apply across the expanded code. Function inlining has advantages over macros in that arguments are evaluated only once, parentheses need not be overused to avoid problems with precedence, and the actual expansion can be controlled from the command line.
The following pragmas are provided to control function inline expansion:
#pragma inline (function_name [,function_name....]) #pragma noinline (function_name [,function_name....]) |
If a function is named in an inline directive, calls to it are expanded as inline code, if the function has the following properties:
Inline functions have the following properties:
Compaq C supports the #pragma linkage and #pragma use_linkage preprocessor directives on OpenVMS Alpha systems.
These pragmas are used for defining special linkage characteristics and
to associate these linkage characteristics with functions. See your
platform-specific Compaq C documentation for more information.
B.44 Other Pragmas
The following pragmas are provided for VAX C compatibility mode only:
#pragma dictionary CDD_path #pragma module title ident |
These pragmas correspond to the #dictionary and #module directives, respectively.
See your platform-specific Compaq C documentation for additional pragmas supported on your system.
Figure C-1 shows the ASCII character set. Each character's octal, decimal, and hexadecimal value is shown.
Figure C-1 ASCII Equivalence Chart
Compaq C supports several common C (old-style C) extensions to ANSI-standard C. These extensions are recognized only when the common C compatibility option is used on the compiler command line. The common C extensions allow you to use the c89 compiler to compile code originally written for the portable C compiler (pcc).
The following sections describe the common C extensions available with the common C compatibility option. Extensions to the ANSI-standard C language are divided into two categories:
1 Parameters to the function main() are only checked in strict ANSI mode. |
D.2 Extensions Incompatible with ANSI C
Previous | Next | Contents | Index |
|