home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!candidus.ma30.bull.com!drg
- From: drg@candidus.ma30.bull.com (Daniel R. Guilderson)
- Newsgroups: gnu.gcc.help
- Subject: [biz.sco.general] Re: gcc 2.3.2 on SCO 3.2.4 (__STDC__)
- Date: 24 Jan 1993 13:47:49 -0500
- Organization: GNUs Not Usenet
- Lines: 70
- Sender: daemon@cis.ohio-state.edu
- Distribution: gnu
- Message-ID: <9301241844.AA09928@candidus.ma30.bull.com>
-
- I know nothing about the ANSI C standard, I just know that RMS has
- said that he designed gcc so that it would have __STDC__ defined as 1
- on all the platforms that it runs on. I don't have time to find and
- read the standard so maybe someone who knows can tell me exactly what
- the function of __STDC__ is. Attached is a message from
- biz.sco.general in which a man claims that __STDC__ should be 1 only
- when the compiler and the libraries are all ANSI conformant. He also
- claims that __STDC__ should be defined as something else (like 0) when
- only the compiler is ANSI conformant. This seems like a confusing and
- useless way to do things.
-
- Please ignore the fact that SCO claims their libraries and header
- files *are* ANSI conformant. I just want to know what the heck
- __STDC__ is supposed to mean.
-
- ------- Start of forwarded message -------
- Newsgroups: biz.sco.general
- From: steve@robobar.co.uk (Steve Bleazard)
- Subject: Re: gcc 2.3.2 on SCO 3.2.4 (__STDC__)
- Organization: Robobar Ltd., Perivale, Middx., ENGLAND.
- Date: Sun, 24 Jan 1993 11:15:14 GMT
-
- In article <DRG.93Jan23131608@candidus.ma30.bull.com> drg@candidus.ma30.bull.com (Daniel R. Guilderson) writes:
- >In article <C1AC8D.JKq@wimsey.bc.ca> sl@wimsey.bc.ca (Stuart Lynne) writes:
- >
- > Saying it is wrong, is well... definitely wrong.
- >
- >I say it is wrong because gcc was designed to have __STDC__ defined as
- >1. I don't remember exactly which program it was but I once ran into
- >a problem were defining __STDC__ to be 0 caused compilation problems.
-
- This is not as cut and dried as it appears. What does __STDC__ mean? The
- standards appear to say (and I'm using P J Plauger & Jim Brodie's Standard
- C book as my reference) __STDC__ is 1 if and only if the ENVIRONMENT is
- ANSI. That is the library and the compiler. Library functions other than
- the ones defined in the standard are definitely out. Before the standard
- was accepted __STDC__ was used to indicate an ansi conformant compiler (and
- in some cases not so conformant - thankyou Microsoft!) rather than an ansi
- environment. This has resulted in a lot of code that uses __STDC__ to mean
- a conformant compiler, not environment. This causes a problem for SCO.
- On the one hand they want to produce a conformant environment - so I can
- check that my program will compile on all conformant systems (including
- non-unix) - and on the other hand there is a lot of code in the world that
- uses __STDC__ to detect an ansi compiler. There solution is fairly good:
- The standard says __STDC__ can be either another number or not defined if
- the environment is not ansi. Every program I have ever seen that depends
- on some ansi feature uses #ifdef. So defining __STDC__ to be 0 solves
- the problem for nearly all cases. Only in the rare case where __STDC__ is
- tested against 1 (or 0) will there be a problem. The headers can now
- say #if !__STDC__ where functions are defined that are not part of the
- standard.
-
- > If you want a GCC compiler that doesn't then fine. Go for it. But
- > don't complain to SCO and ask for support for the munged header files.
- >
- >On the otherhand, if you define __STDC__ to be 0 don't complain to the
- >FSF and ask for support of programs which don't compile correctly.
- >
- I don't think this is an FSF issue, FSF produce a compiler that is ansi
- conformant, they do not yet produce an ansi environment. One can argue
- that they should define __STDC__ as 0, leaving it up to the CPP_SPEC to set
- it to 1 when an ansi environment is being used.
-
- Steve
- --
- Steve.Bleazard@RoboBar.Co.Uk | Phone: +44 81 991 1142 x153
- Snr Software Engineer, Robobar Ltd. | Fax: +44 81 998 8343 (G3)
- 22 Wadsworth Road, Perivale. |
- Middx., UB6 7JD ENGLAND. | ...!ibmpcug!robobar!steve
- ------- End of forwarded message -------
-