Subject: Re: quick question to C programmers
To: Georg Schwarz <georg.schwarz@freenet.de>
From: Hauke Fath <hf@spg.tu-darmstadt.de>
List: tech-pkg
Date: 04/07/2005 17:50:39
Am 07.04.2005 um 17:32 Uhr +0200 schrieb Georg Schwarz:
>  > >#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):
>

[...]

>Is there maybe some additional include missing to the code for Linux and
>FreeBSD???

That's why I asked for the preprocessor output... As listed above, 
NetBSD uses a constant array for stdin, stdout. When I search the 
preprocessor output on a debian linux (gcc 3.3.5), I get an

extern struct _IO_FILE *stdin;
extern struct _IO_FILE *stdout;
extern struct _IO_FILE *stderr;

which looks not necessarily constant for gcc. So it looks like you 
are stumbling over libc stdio implementation details here.

	hauke

-- 
/~\  The ASCII Ribbon Campaign                    Hauke Fath
\ /    No HTML/RTF in email	        Institut für Nachrichtentechnik
  X     No Word docs in email	                  TU Darmstadt
/ \  Respect for open standards              Ruf +49-6151-16-3281