Path: utzoo!telly!ddsw1!lll-winken!csd4.milw.wisc.edu!leah!rpi!tut.cis.ohio-state.edu!MCC.COM!rfg From: rfg@MCC.COM (Ron Guilmette) Newsgroups: gnu.gcc.bug Subject: manual clarification needed Message-ID: <8904281801.AA07198@riunite.aca.mcc.com> Date: 28 Apr 89 18:01:15 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 37 Section 5.10 of the GCC manual should point out that non-constant aggregate initializers are allowed only for variables whose storage class is "auto". For anybody who knows generally how initialization is done in C this is not needed, but other neophytes might find the clarification helpful. Ana example source file and error message are given below to help illustrate what specifically is prohibited. Note that the error message issued is somewhat inaccurate because the variable in question is *not* declared such that its name has "static" linkage (even though it is obvious that the variable's *storage class* is "static"). ---------------------------------------------------------------------- struct s { int i; float f; }; int j; float g; struct s s_global_variable = { j, g }; ---------------------------------------------------------------------- gcc version 1.34.1 /usr/local/src/lib/sun3/gcc-1.34.1/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 test.c /tmp/cca07170.cpp GNU CPP version 1.34.1 /usr/local/src/lib/sun3/gcc-1.34.1/gcc-cc1 /tmp/cca07170.cpp -quiet -dumpbase test.c -version -o test.s GNU C version 1.34.1 (68k, MIT syntax) compiled by GNU C version 1.34.1. test.c:9: initializer for static variable is not constant // Ron Guilmette - MCC - Experimental Systems Kit Project // 3500 West Balcones Center Drive, Austin, TX 78759 - (512)338-3740 // ARPA: rfg@mcc.com // UUCP: {rutgers,uunet,gatech,ames,pyramid}!cs.utexas.edu!pp!rfg