Previous | Contents | Index |
In DEC C, if the argument of the unary
&
operator is an array, the result now has the type "pointer to
array". Previously, in VAX C, the result would have the type
"pointer to the element type of the array".
A.1.25 Unary Plus
DEC C supports the new ANSI C operator, unary plus (+). This
operator returns the value of its operand (possibly widened by the
integral promotions).
A.1.26 Relational Operators
As required by ANSI C, DEC C issues a warning (in all modes except VAX C mode) to diagnose a constraint violation if one of the operands of a relational operator is a pointer to a function. For example, the following code would issue a warning:
int (*f)(); if (f > NULL) |
Note that it is valid to use the equality operators to compare function
pointers.
A.1.27 Assignment Compatibility
ANSI C has tighter assignment compatibility rules than those previously enforced by VAX C. (Note that assignment compatibility rules also control function argument passing.) DEC C assignment compatibility differs from that of VAX C in the following ways:
Function prototype support, the new
const
and
volatile
type qualifiers, and the
void
type, were already implemented in VAX C. The following sections
describe the additional DEC C support that affects
declarations. References are to the relevant sections in the ANSI C
Standard.
A.1.28.1 Implementation Limits
The ANSI C Standard requires that an implementation support certain
minimum requirements; these are listed in the referenced section. In
those cases where VAX C imposes a fixed limit, that limit has always
met or exceeded the Standard's requirements, and programs that exceed
any of these limits elicit the appropriate errors. In strict ANSI C
mode, DEC C now issues diagnostics against any source program
constructs that exceed any of the Standard limits as well.
A.1.28.2 Identifier Name Length
In strict ANSI C mode, DEC C now issues diagnostic messages
against declarations of external names in excess of six characters, or
external names that are intended to denote different objects but that
have the same spelling, and ignores alphabetical case.
A.1.28.3 Diagnosing Empty Declarations
The ANSI C Standard invalidates empty declarations, except for two
special cases: one involving structure/union tags and the other
involving the enumeration type. In strict ANSI C mode, DEC C
issues an error message against any declaration that does not declare
at least one of the following: a declarator, a tag, or the members of
an enumeration.
A.1.28.4 Restriction on Placement of Storage-Class Specifiers
The ANSI C Standard specifies that allowing the placement of any
storage-class specifier other than at the beginning of a declaration is
an obsolete feature. In strict ANSI C mode, DEC C now issues
an informational diagnostic to that effect when appropriate.
A.1.28.5 Diagnosing Old-Style Function Declarations
The ANSI C Standard specifies that old-style function declarations and
definitions (that is, those not using the function prototype format)
are obsolete. Old-style function declarations and definitions cause an
informational message to be issued in all modes except VAX C.
A.1.28.6 Function Definitions Using typedef-names
The ANSI C Standard restricts the form of the declarator in a function
definition: the function type itself may not be inherited from a
typedef
-name; that is, the declarator must explicitly contain a (possibly
empty) parenthesized parameter list. If not, DEC C in strict
ANSI C mode issues an error message.
A.1.28.7 Initialization
DEC C for OpenVMS Systems supports the initialization of unions.
In VAX C, an aggregate initializer consisting of a single item does not have to have the outer braces. The outer braces are required by the ANSI C Standard.
DEC C allows this case in VAX C mode.
A.1.29 Bit-Field Initialization
The DEC C compiler initializes bit-field structure members differently
than VAX C does. See Section 4.7.2.
A.1.30 The Preprocessor
The following sections describe the differences between the VAX C and the DEC C preprocessors. Most of these differences reflect the DEC C preprocessor's conformance to the ANSI C Standard. References are to the relevant sections in the ANSI C Standard.
Note that most VAX C-specific preprocessor extensions are unaffected by
these changes. These extensions continue to be supported quietly in VAX
C mode, but elicit appropriate diagnostics in strict ANSI C mode.
A.1.30.1 White Space Appearing Before the #
The ANSI C Standard removes the VAX C restriction that requires the
#
character introducing a preprocessor directive to always appear in
column 1 of the source line. In DEC C, white space and
comments can now precede the
#
on the same line.
A.1.30.2 The #define Directive and Macro Substitution
Before the ANSI C Standard, the lack of a precise definition of the behavior of macro expansion led to a number of inconsistencies among different C implementations. DEC C, in adhering to the ANSI C Standard, removes these and many other discrepancies by specifying precisely how macro substitution is to be performed:
As required by the ANSI C Standard, DEC C supports two new operators that can appear only within macro definitions:
The ANSI C Standard also makes specific the sequence in which
rescanning and further substitution is to take place, and under what
conditions substitution does not take place. The ANSI C Standard also
specifies under what circumstances a macro may be redefined: only
benign redefinition is allowed, permitting a macro to be redefined only
if the new definition is token-wise identical to the old definition.
A.1.30.3 The #line Directive
The ANSI C Standard specifies that macro substitution can occur on the operands of the #line directive, that the line number operand is restricted to the range 1 to 32,767, and that the file name operand must be treated as any character string literal. VAX C did not support macro substitution on this directive, performed no range checking on the line number, and restricted the length of the character string to 255.
DEC C supports macro substitution on the
#line
directive, diagnoses an out-of-range line number (in strict ANSI C mode
only), and allows the file name character string to be as long as the
maximum length supported by the compiler for ordinary strings. (Note
that the ANSI C Standard requires support for a minimum of 509
characters in a string, and that DEC C supports strings up to
65,535 characters.)
A.1.30.4 The #error Directive
DEC C in both strict ANSI C mode and VAX C mode supports the
new
#error
directive required by the ANSI C Standard.
A.1.30.5 The #pragma builtins Directive
The
#pragma builtins
directive is provided for VAX C compatibility.
DEC C implements #pragma builtins by including the <builtins.h> header file, and is equivalent to #include <builtins.h> on OpenVMS systems.
This header file contains prototype declarations for the built-in
functions that allow them to be used properly. By contrast, VAX C
implemented this pragma with special-case code within the compiler,
which also supported a
#pragma nobuiltins
preprocessor directive to turn off the special processing. Because
declarations cannot be "undeclared", DEC C does not support
#pragma nobuiltins
. Furthermore, the names of all the built-in functions use a naming
convention defined by ANSI C to be in a namespace reserved to the C
language implementation.
A.1.30.6 The #pragma dictionary Directive
The #pragma dictionary preprocessor directive replaces the #dictionary directive, but the latter is still supported in VAX C mode for compatibility.
The
#pragma dictionary
and
#dictionary
preprocessor directives now allow you to specify whether all string
data type variables should be null-terminated.
A.1.30.7 The #pragma extern_model Directive
The
#pragma extern_model
directive is added to control the compiler's interpretation of objects
that have external linkage. This pragma lets you choose the global
symbol model to be used for external variables.
A.1.30.8 The #pragma linkage Directive (ALPHA ONLY)
The
#pragma linkage
preprocessor directive allows you to specify special linkage types for
function calls.
A.1.30.9 The #pragma use_linkage Directive (ALPHA ONLY)
The
#pragma use_linkage
directive associates a previously defined special linkage with a
function.
A.1.30.10 The #pragma message Directive
The
#pragma message
directive controls the issuance of individual diagnostic messages or
groups of messages. Use of this pragma overrides any command-line
options that may affect the issuance of messages.
A.1.30.11 The #pragma module Directive
The
#pragma module
preprocessor directive replaces the
#module
directive, but the latter is still supported in VAX C mode for
compatibility.
A.2 Features Affecting the DEC C Run-Time Library and Include Files
This section describes new features pertaining to the standard header
files in the DEC C Run-Time Library (RTL).
A.2.1 <stddef.h>
The
wchar_t
type is now added to this header file. The declaration of
errno
is also removed.
A.2.2 <ctype.h>
Because the ANSI C Standard refers to the macros in <ctype.h> as functions, the <ctype.h> header file now includes function prototypes for functions in the DEC C RTL that perform the same operations as the macros currently defined in this header file. These functions have been added to the DEC C RTL.
The nonstandard
toascii
macro remains because, according to the ANSI C Standard, Section
4.14.2, names beginning with "to" are reserved by the ANSI C
Standard when
<ctype.h>
is included.
A.2.3 <fp_class.h>
This header file containing IEEE floating-point class constants has
been added to support the new DEC C RTL functions
fp_class
,
fp_classf
, and
fp_classl
available on OpenVMS Alpha systems.
A.2.4 <locale.h>
The new standard header file
<locale.h>
is now supported and includes prototypes for the functions
setlocale
and
localeconv
, which have been added to the DEC C RTL.
A.2.5 <math.h>
The functions
cabs
and
hypot
are no longer defined in the
<math.h>
header file when the compiler is run in strict ANSI C mode.
A.2.6 <signal.h>
The sigabrt signal is implemented and defined in the <signal.h> header file. sig_atomic_t is now defined as char . In strict ANSI C mode, the following are not declared: ssignal , gsignal , kill , pause , sleep , sigvec , sigblock , sigsetmask , sigstack , and sigpause .
In strict ANSI C mode, the names of the ill_* and fpe_* macros are changed to begin with " sig " (for example, sigill_resad_fault , sigfpe_intovf_trap , and so on) or be removed.
The
badsig
macro is renamed to
sig_err
.
A.2.7 <stdio.h>
The <stdio.h> header file now defines the type size_t and no longer includes <stdarg.h> . The v*printf functions are now prototyped using the type that va_list is defined to be (that is, char * ).
In strict ANSI C mode, the following macros are not visible: true , false , seek_eof , open_max , l_ctermid , l_cuserid , l_lcltmpnam , l_nettmpnam , and file_type . In strict ANSI C mode, the following functions are not visible: fgetname , fdopen , getw , and putw .
The rename function is added.
The fflush function is modified so that a null argument causes it to flush all files.
The printf function is modified to provide the following support:
The scanf function is modified to handle white space as specified by the ANSI C Standard. The %p specifier is added. The l flag for long double is added.
The clearerr , feof , and ferror macros are now provided as both macros and functions. By default, they are accessed as macros. To access them as functions, perform an #undef on the macro of the same name. For example:
#undef clearerr |
The <stdlib.h> header file is modified to define size_t and wchar_t directly, rather than including <stddef.h> . The names of the div_t and ldiv_t structures now begin with underscores.
The mb_cur_max macro is added.
The multibyte character and string functions mblen , mbtowc , wctomb , mbstowcs and wcstombs are added as specified in Sections 4.10.7 and 4.10.8 of the ANSI C Standard.
The
abort()
function is changed to only raise a
sigabrt
signal.
A.2.9 <string.h>
The
strcoll
and
strxfrm
functions are added as specified in the ANSI C Standard, Sections
4.11.4.3 and 4.11.4.5.
A.2.10 <time.h>
In strict and relaxed ANSI C modes, the following changes apply to the <time.h> header file:
The
mktime
and
strftime
functions are added as specified in the ANSI C Standard, Sections
4.12.2.3 and 4.12.3.5, respectively.
A.3 Unsupported Features
DEC C for OpenVMS Systems does not support parallel processing on either OpenVMS VAX or OpenVMS Alpha systems and, therefore, does not support the following qualifiers and preprocessor directives:
Previous | Next | Contents | Index |