Want the word on __STDC__

Rahul Dhesi dhesi%cirrusl at oliveb.ATC.olivetti.com
Thu Mar 7 12:23:33 AEST 1991


In <668288453.3046 at mindcraft.com> fred at mindcraft.com (Fred Zlotnick) 
recommends the test

>  #if __STDC__ == 1

to detect nonconforming implementations.  Unfortunately there are
two problems with this.

First, it is quite possible that a future ANSI C standard will bump up
the value of __STDC__ to 2, thus breaking code that assumes that
(__STDC__ != 1) implies (not standard C).

Second, some existing nonconforming implementations of C will
fail to compile expressions like

   #if something == something.

Now you may say these implementations aren't C, and you might be right,
but they are *called* C by many users, and they will be upset that
ostensibly portable C code won't compile.  Truly defensive programmers
assume that the preprocessor does not understand C expressions.  Such
flaky implementations are fortunately dying out, but I could easily
ruffle through my old disks and find a few that aren't quite dead yet.
--
Rahul Dhesi <dhesi%cirrusl at oliveb.ATC.olivetti.com>
UUCP:  oliveb!cirrusl!dhesi



More information about the Comp.std.c mailing list