home *** CD-ROM | disk | FTP | other *** search
- 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
- From: davea@quasar.mti.sgi.com (David B.Anderson)
- Newsgroups: comp.sys.sgi
- Subject: Re: Bug in SGI ansi compliance (or are the others wrong ?)
- Message-ID: <s5c02sg@sgi.sgi.com>
- Date: 9 Nov 92 17:01:56 GMT
- Sender: davea@quasar.mti.sgi.com
- Organization: Silicon Graphics, Inc. Mountain View, CA
- Lines: 42
-
- In article <1992Nov9.140450.591@bernina.ethz.ch> torda@igc.ethz.ch (Andrew Torda) writes:
- >The following two lines of code don't compile with the -ansi option to
- >the sgi cc compiler (version 3.10)
- >
- >---------- begin code ----------
- >#include <stdio.h>
- >FILE *fp = stdout;
- >---------- end code ----------
- >
- >On an sgi machine I get:
- >% cc -c z.c
- >% cc -c -ansi z.c
- >accom: Error: z.c, line 2: integer constant expected
- > FILE *fp = (__stdout) ;
- > ----------------------------^
- >
- >but it compiles using gcc's -pedantic option and the strict
- >conformance option to sun's unbundled ansi C compiler.
- >
- >Which compiler is correct ? SGI's or the others ?
-
- All three. There is no requirement in the standard that stdout be a
- constant.
-
- This (normally minor)annoyance was introduced with -ansi because
- The value of stdout with -xansi is (&_iob[1]) which, though a constant,
- collides with the user namespace in:
-
- #include <stdio.h>
- int samplefunc()
- { {
- int _iob = 0;
- fprintf(stdout,"test\n",_iob);
- }
- }
-
- I a future release the constant form is reintroduced and stdout is
- (&__iob[1]) when a pure ANSI C namespace is requested.
-
- Sorry, but for 4.0.x we could not rename _iob. It was too far-reaching
- a change to contemplate.
- [ David B. Anderson (415)390-4263 davea@sgi.com ]
-