__STDC__ and non-conforming ANSI C compilers

Colin Plumb w-colinp at microsoft.UUCP
Mon Jan 16 10:08:46 AEST 1989


gwyn at brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>) wrote:
> I maintain that predefining __STDC__ is a mistake, except when the
> implementation conforms to the Standard (in which case __STDC__ is
> necessarily preset to 1, for the current standard, or some number
> greater than 1, presumably, for a future compatible standard).
> There is no way you can know what use a programmer is making of
> __STDC__.  In fact your guess was wrong for some of the code we
> have..

True, but if the programmer is really exercising the ANSI C standard, they'll
know about the __STDC__ == 1 (#if __STDC__ is shorter, anyway!) and won't
get caught.  But if, as is very popular, they use ##ifdef __STDC__ as a
switch to tell whether to use ANSI cpp-isms or Reiser tricks for
token-pasting, or whether they can include prototypes, or use void *, etc.,
it'll work.

It seems like a reasonable convention to me.
-- 
	-Colin (uunet!microsof!w-colinp)



More information about the Comp.std.c mailing list