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

  1. Path: sparky!uunet!charon.amdahl.com!pacbell.com!att!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!destroyer!ncar!noao!amethyst!organpipe.uug.arizona.edu!news
  2. From: dave@cs.arizona.edu (Dave Schaumann)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: How to handle __STDC__
  5. Keywords: ANSI C, prototypes
  6. Message-ID: <1992Aug30.163757.24804@organpipe.uug.arizona.edu>
  7. Date: 30 Aug 92 16:37:57 GMT
  8. References: <393@bsovax.UUCP> <hawkeye.715165677@glia>
  9. Sender: news@organpipe.uug.arizona.edu
  10. Reply-To: dave@cs.arizona.edu (Dave Schaumann)
  11. Organization: University of Arizona
  12. Lines: 34
  13. In-Reply-To: hawkeye@glia.biostr.washington.edu (Ken Keys - TF Dude)
  14.  
  15. In article <hawkeye.715165677@glia>, hawkeye@glia (Ken Keys - TF Dude) writes:
  16. [question deleted]
  17. >The ANSI/ISO standard does say that __STDC__ must be defined as 1 in
  18. >any standard-conforming compiler.
  19.  
  20. The obvious conclusion is that the right way to check if you are compiling
  21. under a standard-conforming compiler is to use "#if __STDC__".
  22.  
  23. >However, since a non-standard
  24. >compiler is, by definition, not bound by the standard, it can do
  25. >whatever it wants, including defining __STDC__ as 1.
  26.  
  27. Well, if you want to worry about this, you could do this:
  28.  
  29.     /* If this breaks because your non-standard compiler */
  30.     /* #define's __STDC__ to 1, complain to you vendor,  */
  31.     /* and not to the author of the code.             */
  32.     #if __STDC__
  33.  
  34.     . . .
  35.  
  36. >I agree, however,
  37. >defining __STDC__ as 0 was a bad choice on the part of Mark Willams,
  38.  
  39. Agreed (assuming ANSI gave no meaning to "#define __STDC__ 0").
  40.  
  41. >a lot of existing code does use the "#ifdef __STDC__" check.
  42.  
  43. Well, as I indicated above, my reading of the quote you gave is that
  44. "#if __STDC__" is clearly the right choice for checking for a compliant
  45. compiler.  Using "#ifdef __STDC__" is IMHO sloppy work.
  46.  
  47. -- 
  48. Dave Schaumann            dave@cs.arizona.edu
  49.