Concatenating with a compile-time definition in "ANSI" CPP

david.f.prosser dfp at cbnewsl.ATT.COM
Sat Oct 7 04:01:13 AEST 1989


In article <834 at crdos1.crd.ge.COM> davidsen at crdos1.UUCP (bill davidsen) writes:
>  What is the level of ANSI compliance [in the AT&T compiler] without -Xt (or
>with whatever option is needed). Are there any major new features which are
>missing in whatever passes for ANSI mode? Can ANSI be made default?

No major new features are missing in any mode.  A shell script can be used
as a front end to cc(1) if a different default mode is desired, for example.

There are three modes specifying different levels of conformance.
 -Xt  (Transition)  This is the initial default mode.
 -Xa  (ANSI C)      This will become the default in a subsequent release.
 -Xc  (Conforming)  This won't ever be the default.

All three modes include as many features of ANSI C as can fit.  The major
difference between -Xt and -Xa is the integral promotion rules.  (These
have been discussed many times already in this group and comp.std.c.)  All
expressions that might behave differently depending on the different
promotion rules are warned about in all modes.  A simple use of a cast is
all that is needed to eliminate these warnings.

There are only two differences between -Xa and -Xc.  The important one is
that -Xc restricts the name space to that required for ANSI C conformance.
The other is that all the required diagnostics are issued as required in
-Xc.

__STDC__ is predefined in all modes.  It is replaced by 0 in -Xt and -Xa.
(This is viewed as inappropriate by some people.)  Its value is 1 only in
-Xc, thus specifying true conformance.

Where ever possible, those features of AT&T's previous C compilers and
preprocessors that did not produce warnings and that are not compatible
with ANSI C are available in -Xt, but will produce warnings.  If the
feature is simply incompatible with ANSI C, it is not available in -Xa
or -Xc.  If a feature is a compatible extension, it will exist in all
modes (although some do require a diagnostic in -Xc).

If you want more information send me mail.
Dave Prosser



More information about the Comp.lang.c mailing list