From: fjh AT cs DOT mu DOT OZ DOT AU (Fergus Henderson) Subject: Re: BUG: stdin not a constant 4 Dec 1997 01:22:39 -0800 Message-ID: <199712040820.TAA17063.cygnus.gnu-win32@mundook.cs.mu.OZ.AU> References: <199712040048 DOT LAA26596 AT rimmer DOT cs DOT mu DOT OZ DOT AU> To: gnu-win32 AT cygnus DOT com Cc: petdr AT students DOT cs DOT mu DOT oz DOT au Peter David ROSS writes: >The following code doesn't compile. > >------ >#include > >static FILE *out = stdout; > >void main(void) >{ > /* out = stdout; */ > fprintf(out, "hello world\n"); >} That code is not ANSI/ISO-conformant C. The ANSI/ISO C standard does not require `stdout' to be a constant suitable for use in a static initializer. >The fix is to remove the initialiser and add the line which is commented out. Correct. >However the code I am trying to port has these sort of variables spread >all over the place, You have my sympathy ;-) >and I would like to know if there is someway I can >get the compiler to treat it as a constant. I'm fairly sure there's no simple way. I think you'll just have to fix your non-conformant source code. -- Fergus Henderson | "I have always known that the pursuit WWW: | of excellence is a lethal habit" PGP: finger fjh AT 128 DOT 250 DOT 37 DOT 3 | -- the last words of T. S. Garp. - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".