delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/12/03/19:41:23

From: petdr AT students DOT cs DOT mu DOT oz DOT au (Peter David ROSS)
Subject: BUG: stdin not a constant
3 Dec 1997 19:41:23 -0800 :
Message-ID: <199712040048.LAA26596.cygnus.gnu-win32@rimmer.cs.mu.OZ.AU>
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

Hi,

The following code doesn't compile. 

------
#include <stdio.h>

static FILE *out = stdout;

void main(void)
{
    /* out = stdout; */
    fprintf(out, "hello world\n");
}
------

It gets the following error message:
test.c:3: initializer element is not constant

The fix is to remove the initialiser and add the line which is commented
out.

However the code I am trying to port has these sort of variables spread
all over the place, and I would like to know if there is someway I can
get the compiler to treat it as a constant.

Pete.
----
 +----------------------------------------------------------------------+
 | Peter Ross    Sci/Eng Melbourne Uni                                  |
 | email: petdr AT cs DOT mu DOT oz DOT au     WWW: http://www.cs.mu.oz.au/~petdr      |
 +----------------------------------------------------------------------+
-
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".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019