__STDC__ and non-conforming ANSI C compilers

Sue Meloy sue at hpclsue.HP.COM
Thu Jan 19 05:50:57 AEST 1989


To me, the question boils down to name space and extensions.
I feel __STDC__ should definitely not be defined unless all 
syntax of the ANSI standard is allowed (prototypes, token pasting, ...).  
Although AT&T apparently thinks differently, I also feel that __STDC__ 
should not be defined if the semantics are different from ANSI.

But, for syntax extensions and name space pollution, I do feel that it
may be reasonable to define __STDC__.  In particular, POSIX requires
additional names that would pollute a strict ANSI name space.  Is it
reasonable to say that __STDC__ should not be defined in a POSIX
implementation?

As for syntax extensions (accepted silently), no strictly-conforming 
program should be affected.  Programs that use the extension would not 
receive a diagnostic, rendering the implementation non-standard, so 
theoretically __STDC__ should not be defined.

Would defining __STDC__ in either of these situations cause problems?
If not, is it OK to define it to 1, or should it be 0?  Doug, you
mentioned that one implementation "guessed wrong" about your intent 
for using __STDC__.  Could you elaborate on the problems it caused?



More information about the Comp.std.c mailing list