🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #52744

Re: #if's and !

#52744
From: Kai Henningsen
Date: Sun, 31 May 1992 15:24
52 lines
3064 bytes
sC> Von : sef@kithrup.COM (Sa, 30.05.92 00:42)
sC> Name: Sean Eric Fagan
sC> Box : Kithrup Enterprises, Ltd.
sC> MId : <1992May29.234233.1107@kithrup.COM>
sC> RId : <1992May29.153243.20383@taumet.com>

sC> To be a conformant program, you, as the programmer, can only check for
sC> __STDC__ being defined *AND DEFINED TO 1*.  Any other check is
sC> non-conformant.

As I understand it, from a legalist standpoint, a conformant program doesn't
need to check for anything at all, since a conforming implementation WILL have
__STDC__ defined as 1.

And if it's not a conforming implementation, then all bets are off: the
standard guarantees *nothing* about these implementations. Legally, they could
very well have __STDC__ == 1.

So where does that leave us? Simple: the legalist standpoint is no use in this
case. You have to follow the intention, not the letter.

Now, what is the intention?

Section 3.8.8 says "__STDC__ The decimal constant 1, intended to indicate a
conforming implementation."

The rationale (always good for questions of intent) says "The macro __STDC__
allows for conditional translation on whether the translator claims to be
standard-conforming or not. It is defined as having value 1; future versions of
the Standard could define it as 2, 3, ..., to allow for conditional compilation
on which version of the Standard a translator conforms to. This macro should be
of use in the transition toward conformance to the Standard."

Now, what does that mean? I believe it definitely means that a value of 0 was
never intended for __STDC__. There is absolutely no hint as to what that would
mean. (If you don't interpret it as "We are as non-conforming as K&R I".)

sC> There are a lot more portability problems than that, however.

Indeed. Even if everybody consented on how __STDC__ *should* be used, we would
still face the problem of lots of compilers that claim conformance even if it's
not completely true. For example, several compilers don't support trigraphs.
Yes, nobody *wants* trigraphs; but if you want to accmmodate them with
conditional compilation, you're out in the cold again because __STDC__ == 1
*doesn't* guarantee you trigraphs work, even if it should.

As long as you program for non-conformant compilers, __STDC__ is only a hint.
When you don't, it's useless as long as there is no standard for __STDC__ > 1.

It was a nice try, though. Too bad Real World(tm) prevented it from working ...

MfG Kai
Technical Details
Message-ID: <A41539@MS.maus.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!uniol!hb.maus.de!ms.maus.de!Kai_Henningsen
References: <A38256@HB.maus.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,602cd848de9933fc
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-06-01 14:55:50 PST
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!news.netmbx.de!zrz.tu-berlin.de!math.fu-berlin.de!uniol!hb.maus.de!ms.maus.de!Kai_Henningsen
From: Kai_Henningsen@ms.maus.de (Kai Henningsen)
Newsgroups: gnu.gcc.help
Subject: Re: #if's and !
Message-ID: <A41539@MS.maus.de>
Date: Sun, 31 May 92 15:24:00 GMT
References: <A38256@HB.maus.de>
Organization: MausNet
Lines: 52
X-Gateway: MausGate/News 1.06