This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with non-constant initializers


(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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]