home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / sgi / 16167 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1.7 KB  |  53 lines

  1. Path: sparky!uunet!news.tek.com!uw-beaver!cs.ubc.ca!destroyer!sol.ctr.columbia.edu!spool.mu.edu!olivea!sgigate!sgi!quasar.mti.sgi.com!davea
  2. From: davea@quasar.mti.sgi.com (David B.Anderson)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Re: Bug in SGI ansi compliance (or are the others wrong ?)
  5. Message-ID: <s5c02sg@sgi.sgi.com>
  6. Date: 9 Nov 92 17:01:56 GMT
  7. Sender: davea@quasar.mti.sgi.com
  8. Organization: Silicon Graphics, Inc.  Mountain View, CA
  9. Lines: 42
  10.  
  11. In article <1992Nov9.140450.591@bernina.ethz.ch> torda@igc.ethz.ch (Andrew Torda) writes:
  12. >The following two lines of code don't compile with the -ansi option to
  13. >the sgi cc compiler (version 3.10)
  14. >
  15. >---------- begin code ----------
  16. >#include <stdio.h>
  17. >FILE *fp = stdout;
  18. >---------- end code   ----------
  19. >
  20. >On an sgi machine I get:
  21. >% cc -c z.c
  22. >% cc -c -ansi z.c
  23. >accom: Error: z.c, line 2: integer constant expected
  24. >       FILE *fp =       (__stdout) ;
  25. >       ----------------------------^
  26. >
  27. >but it compiles using gcc's -pedantic option and the strict
  28. >conformance option to sun's unbundled ansi C compiler.
  29. >
  30. >Which compiler is correct ? SGI's or the others ?
  31.  
  32. All three.  There is no requirement in the standard that stdout be a
  33. constant.
  34.  
  35. This (normally minor)annoyance was introduced with -ansi because
  36. The value of stdout with -xansi is (&_iob[1]) which, though a constant,
  37. collides with the user namespace in:
  38.  
  39. #include <stdio.h>
  40. int samplefunc()
  41. { {
  42.         int _iob = 0;
  43.         fprintf(stdout,"test\n",_iob);
  44.   }
  45. }
  46.  
  47. I a future release the constant form is reintroduced and stdout is
  48. (&__iob[1]) when a pure ANSI C namespace is requested.
  49.  
  50. Sorry, but for 4.0.x we could not rename _iob. It was too far-reaching
  51. a change to contemplate.
  52. [ David B. Anderson             (415)390-4263             davea@sgi.com ]
  53.