This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
RE: Compiler bug?
- To: "'Stipe Tolj'" <tolj at uni-duesseldorf dot de>, jimen at adtech-inc dot com, Geoffrey Noer <noer at cygnus dot com>
- Subject: RE: Compiler bug?
- From: Stephan Mueller <smueller at microsoft dot com>
- Date: Thu, 28 May 1998 18:17:10 -0700
- Cc: "'gnu-win32 at cygnus dot com'" <gnu-win32 at cygnus dot com>
Your mileage may vary. Gcc is right about needing a constant initializer.
The code in question is depending on stdin being a constant. Is it? Well,
it might be.
My favourite C reference, (Harbison and Steele) refers to stdin, stdout and
stderr as external _variables_ that are initialized prior to the start of a
program (i.e. before main() is called.) Stdin doesn't have to be a
constant.
But it can be. A common way to implement stdin is something like:
#define stdin (&iob[0])
which is a compile-time constant.
Disclaimer: I don't have any cygwin bits handy, so I can't check if any of
this is directly applicable to b19. But I'm willing to bet a Canadian
dollar that the FreeBSD stdio.h does something like the #define above,
whereas the cygwin stdio.h may not.
stephan(speaking for myself only, not for anyone's employer);
> -----Original Message-----
> From: Stipe Tolj [SMTP:tolj@uni-duesseldorf.de]
> Sent: Thursday, May 28, 1998 1:05 AM
> To: jimen@adtech-inc.com; Geoffrey Noer
> Cc: 'gnu-win32@cygnus.com'
> Subject: Re: Compiler bug?
>
> Jimen Ching wrote:
>
> > I can't compile this code with b19. Is this supposed to be allowed?
> >
> > #include <stdio.h>
> > FILE *xyz = stdin;
> > int main() { return 0; }
>
> hmm, gcc says you need an constant initializer for an variable.
>
> My gcc 2.7.2.1 on FreeBSD 3.0 machine compiles without any comment. Is it
> a
> bug?
>
>
> Stipe.
>
> --
> stud.rer.pol. Stipe Tolj <tolj@uni-duesseldorf.de>
> Department of Economical Computer Science
> University of Cologne, Germany
> http://www-public.rz.uni-duesseldorf.de/~tolj
>
>
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".