🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #2533

Re: Want the word on __STDC__

#2533
From: Eamonn McManus
Date: Thu, 07 Mar 1991 18:55
28 lines
1470 bytes
fred@mindcraft.com (Fred Zlotnick) writes:
>... 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__

There are problems with that, though, quite apart from otherwise
conforming hypothetical implementations that define __STDC__ to be other
than 1.  The replacement of undefined identifiers by 0 may have been a de
facto Unix standard but it was nowhere mentioned in K&R1 so it would have
been reasonable for a pre-standard implementation to make it an error for
a #if to contain an undefined identifier.

If I want my code to run on pre-standard implementations (which presumably
I do if I care about __STDC__) then I am reluctant to depend on
  #if __STDC__
or
  #if __STDC__ == 1
rather than
  #ifdef __STDC__
which would have been safe had it not been for cretinous implementors who
made half-standard implementations with __STDC__ defined but 0.

,
Eamonn
Technical Details
Message-ID: <lampblack@dce.ie>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!dce.ie!em
References: <4203@lupine.NCD.COM> <15381@smoke.brl.mil> <668288453.3046@mindcraft.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!dce.ie!em
From: em@dce.ie (Eamonn McManus)
Newsgroups: comp.std.c
Subject: Re: Want the word on __STDC__
Message-ID: <lampblack@dce.ie>
Date: 7 Mar 91 18:55:37 GMT
References: <4203@lupine.NCD.COM> <15381@smoke.brl.mil> <668288453.3046@mindcraft.com>
Organization: Datacode Communications Ltd, Dublin, Ireland
Lines: 28