Subject: Re: quick question to C programmers
To: Hauke Fath <hf@spg.tu-darmstadt.de>
From: Georg Schwarz <georg.schwarz@freenet.de>
List: tech-pkg
Date: 04/07/2005 17:32:18
> >#include <stdio.h>
> >FILE *a = {stdin}, *b = {stdout};
>
> Interesting. Works fine for me with both gcc 3.3.3 (i386 netbsd-2)
> and egcs-1.1.2 (mac68k netbsd-1-5-4).
>
> The preprocessor output has
>
> FILE *a = { (&__sF[0]) }, *b = { (&__sF[1]) };
>
> in both cases, so the curly braces look redundant.
so I ran this on a few machines (compiling cc -c):
NetBSD 2.0/i386 gcc 3.3.3: works
FreeBSD 5.3 gcc 3.4.2:
x.c:2: error: initializer element is not constant
x.c:2: error: (near initialization for `a')
x.c:2: error: initializer element is not constant
x.c:2: error: (near initialization for `b')
Linux 2.2 or 2.4 with gcc 2.95.4:
x.c:2: initializer element is not constant
x.c:2: (near initialization for `a')
x.c:2: initializer element is not constant
x.c:2: (near initialization for `b')
SunOS 5.8 sparc with Sun cc: works
SunOS 5.8 sparc with gcc 2.95.3: works
IRIX 5.3 with SGI IDO cc: works
IRIX 5.3 with gcc 3.4.3: works
Is there maybe some additional include missing to the code for Linux and
FreeBSD???
--
Georg Schwarz http://home.pages.de/~schwarz/
georg.schwarz@freenet.de +49 178 8545053