Subject: RE: Compiler bug?
From: [email-masked] (Stephan Mueller)

29 May 1998 00:59:42 -0700
Message-ID: <[email-masked]>
To: "'Stipe Tolj'" <[email-masked]>, [email-masked],
        Geoffrey Noer <[email-masked]>
Cc: "[email-masked]'" <[email-masked]>

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:[email-masked]]
> Sent:	Thursday, May 28, 1998 1:05 AM
> To:	[email-masked]; Geoffrey Noer
> Cc:	[email-masked]'
> 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 <[email-masked]>
> 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
> "[email-masked]" with one line of text: "help".
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".