This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Problem with non-constant initializers
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Problem with non-constant initializers
- From: Eric Scharff <Eric dot Scharff at Colorado dot EDU>
- Date: Sun, 26 Sep 1999 22:29:58 -0600 (MDT)
(Probably not a bug, but I can't find documentation or see why this doesn't
work)
GCC Version:
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
OS: Redhat 6.0 on i686, Kernel 2.2.11
--- input file tst.c ---
#include <stdio.h>
FILE *xout = stdout;
int main(int argc, char *argv[]) {
fprintf(xout, "Hi there!\n");
}
---
gcc tst.c
tst.c:3: initializer element is not constant
This should be legal. It is in older (non egcs) versions of gcc.
Note that it works if the initializer (line 3) is inside a function.
Many thanks,
-Eric Scharff