__STDC__ and non-strictly conforming ANSI C compilers

Colin Plumb w-colinp at microsoft.UUCP
Wed Dec 21 20:44:51 AEST 1988


In article <14179 at oberon.USC.EDU> english at stromboli.usc.edu (Joe English) writes:
>I'm still unclear on the meaning of __STDC__... does it mean
>"supports prototypes, void, signed, etc.," or "strictly conforming,
>no extensions?"  Or is this not specified?  

It means "will compile any strictly conforming program", strictly conforming
being a program which doesn't use any undefined or implementation-defined
features of the ANSI C standard.

It guarantees that there are no incompatible extensions to the language,
so any program that compiles without the extensions will also compile with
them.  New keywords or identifiers break this badly.

For an example of an extension that is okay with __STDC__=1, try:

anything using @ or $
(since they're not part of the C character set)
int c : 64;
(defining variables in terms of bits)
register int foo();
(e.g. for function inlining)
char x[0];
(as the last element of a struct; I can do malloc(sizeof mystruct + arraysiz);)

or any number of things that don't interfere with existing C.
-- 
	-Colin (uunet!microsof!w-colinp)



More information about the Comp.std.c mailing list