compile-error: stdin is not a constant
Daniel Jacobowitz
drow at false.org
Thu Nov 4 02:36:18 EST 1999
On Wed, Nov 03, 1999 at 01:25:44PM +0100, Wolfgang Haeuptli wrote:
>
> Hello people
>
> sorry for the (probably) basic question...
>
> Since I installed R5, some programs (that used to compile OK on R4)
> complain about :
>
> initializer element for 'foo' is not constant
>
> while compiling constructs like:
>
> FILE *foo = stdin; (or FILE *foo = {(FILE *) stdin}; )
Because it isn't a constant any more.
>
> when I replaced this line with: FILE *foo = STDIN_FILENO;
> ( defined in unistd.h), compilation works, but the resulting program
> segfaults...
Which should generate one hell of a warning, since STDIN_FILENO is a
small number, not a struct FILE *.
You need to initialize the variable early in main() or something along
those lines, or you can declare a constructor using __attribute__,
although I do not remember the syntax (search list archives).
Dan
/--------------------------------\ /--------------------------------\
| Daniel Jacobowitz |__| SCS Class of 2002 |
| Debian GNU/Linux Developer __ Carnegie Mellon University |
| dan at debian.org | | dmj+ at andrew.cmu.edu |
\--------------------------------/ \--------------------------------/
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list