home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 12966 < prev    next >
Encoding:
Internet Message Format  |  1992-08-30  |  1.9 KB

  1. Path: sparky!uunet!mcsun!Germany.EU.net!math.fu-berlin.de!Sirius.dfn.de!darwin.sura.net!wupost!usc!rpi!uwm.edu!ogicse!news.u.washington.edu!glia!hawkeye
  2. From: hawkeye@glia.biostr.washington.edu (Ken Keys - TF Dude)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to handle __STDC__
  5. Keywords: ANSI C, prototypes
  6. Message-ID: <hawkeye.715165677@glia>
  7. Date: 30 Aug 92 09:07:57 GMT
  8. Article-I.D.: glia.hawkeye.715165677
  9. References: <393@bsovax.UUCP>
  10. Sender: news@u.washington.edu (USENET News System)
  11. Organization: University of Washington
  12. Lines: 37
  13.  
  14. In <393@bsovax.UUCP> albert@bsovax.UUCP (Albert van der Horst) writes:
  15.  
  16. >C) concerning __STDC__
  17. >This built in #define is used most often to govern the use of
  18. >prototypes.
  19.  
  20. >K&C II says about __STDC__ :
  21. >" __STDC__ may only be one if the C-system is ANSI standard"
  22. >or some such.
  23.  
  24. >This would imply that you can have "#define __STDC__ 2"
  25. >on a non standard system. Mark Williams is doing something
  26. >substantially more reasonable : "#define __STDC__ 0" to convey that
  27. >its c-compiler is not standard.
  28.  
  29. >The result is that I cannot compile programs that use
  30. >"#ifdef __STDC__". However this seems common practice in sources
  31. >distributed via the net, but I have seen "#if __STDC__" as well.
  32.  
  33. >Can someone with access to (and understanding of!) the official
  34. >standard please give an authoritive answer to this?
  35.  
  36. The ANSI/ISO standard does say that __STDC__ must be defined as 1 in
  37. any standard-conforming compiler.  However, since a non-standard
  38. compiler is, by definition, not bound by the standard, it can do
  39. whatever it wants, including defining __STDC__ as 1.  I agree, however,
  40. defining __STDC__ as 0 was a bad choice on the part of Mark Willams,
  41. since a lot of existing code does use the "#ifdef __STDC__" check.  My
  42. only suggestion is to use "#if __STDC__" in your own code, and hope
  43. no vendor is stupid enough to #define __STDC__ 1 in a non-standard
  44. compiler.
  45.  
  46. -- 
  47. --
  48. Ken Keys, aka Hawkeye
  49. Master of the Fugue
  50. kkeys@ucsd.edu or hawkeye@ucsd.edu
  51.