🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2525

Re: Want the word on __STDC__

#2525
From: Fred Zlotnick
Date: Wed, 06 Mar 1991 19:40
33 lines
1909 bytes
In article <15381@smoke.brl.mil> gwyn@smoke.brl.mil (Doug Gwyn) writes:
>In article <4203@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes:
>>I assume that you also get irrate about implementors who define __STDC__
>>to something other than 1.
>
>I have no problem with an otherwise CONFORMING implementation defining
>__STDC__ to something other than 1, although why would it?  At least
>that does not cause problems for strictly conforming applications.

But it CAN cause problems (in addition to which, such an implementation
is no longer conforming according to section 3.8.8): since we know that
nonconforming implementations do in fact sometimes define __STDC__ to
something other than 1, it would be useful to protect your code by using
the test

  #if __STDC__ == 1

rather than

  #ifdef __STDC__

This works if __STDC__ is not defined, since (according to 3.8.1) it is
"replaced with the pp-number 0".  But it won't give the desired result if
an "otherwise CONFORMING implementation" has __STDC__ defined to a value
not 1.

You could argue that nonconforming implementations are free to do whatever
they like, including defining __STDC__ to be 1.  But this would be nasty,
and in practice no intentionally nonconforming implementation is likely to
do it.
Fred Zlotnick                       |	#include <std.disclaimer>
fred@mindcraft.com                  |	#include <brilliant.quote>
...!{decwrl,ames,hpda}!mindcrf!fred |
Technical Details
Message-ID: <668288453.3046@mindcraft.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!mindcraft.com!fred
References: <4755@lib.tmc.edu> <15260@smoke.brl.mil> <4203@lupine.NCD.COM> <15381@smoke.brl.mil>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!ames!mindcraft.com!fred
From: fred@mindcraft.com (Fred Zlotnick)
Newsgroups: comp.std.c
Subject: Re: Want the word on __STDC__
Message-ID: <668288453.3046@mindcraft.com>
Date: 6 Mar 91 19:40:52 GMT
References: <4755@lib.tmc.edu> <15260@smoke.brl.mil> <4203@lupine.NCD.COM> <15381@smoke.brl.mil>
Organization: Mindcraft, Inc.
Lines: 33