Non-constant initializers

Per Bothner
Tue Apr 21 23:21:00 GMT 1998

> It seems that code like
> FILE *f = stdin;
> fail because of non-constant initializer.  This did not happen before.

Er, whether this works depends on whether the language or C or C++
(whcih you did not specify) and what the definition of stdin is in
your C libraries (which you also did not specify).

It is supposed to work in C++, and it is undefined whether it works
in C:  It depends on the definition of stdin.  Under traditional
Unix it works, because stdin is &_iob[0]; under many other systems
it doesn't.  This is not a bug in egcs or libc, but a bug in your code.

	--Per Bothner
Cygnus Solutions

More information about the Gcc mailing list