Mail Archives: cygwin/1998/05/29/00:59:42
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 AT uni-duesseldorf DOT de]
> Sent: Thursday, May 28, 1998 1:05 AM
> To: jimen AT adtech-inc DOT com; Geoffrey Noer
> Cc: 'gnu-win32 AT cygnus DOT 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 AT uni-duesseldorf DOT 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 AT cygnus DOT com" with one line of text: "help".
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -