home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / gcc / help / 3019 < prev    next >
Encoding:
Internet Message Format  |  1993-01-24  |  4.1 KB

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