Subject: Re: c compilers
To: None <port-i386@netbsd.org>
From: None <collver@linuxfreemail.com>
List: port-i386
Date: 10/14/2001 12:13:46
On Sat, Oct 13, 2001 at 06:20:35AM -0700, collver@linuxfreemail.com wrote:
> ...The problem here is that (stdin, stdout, stderr) are indexed to an array
> of FILE structures, and that GCC and LCC produce FILE structures of
> different sizes.  The array is defined in GCC compiled code
> (/usr/lib/libc.so), but indexed by LCC compiled code...

NetBSD 1.5.2's libc:
$ grep '	std[ioe]' /usr/include/stdio.h
#define stdin   (&__sF[0])
#define stdout  (&__sF[1])
#define stderr  (&__sF[2])

Linux's libc:
$ grep '\*std' /usr/src/glibc-2.2.3/sysdeps/posix/defs.c  
FILE *stdin = &stdstreams[0];
FILE *stdout = &stdstreams[1];
FILE *stderr = &stdstreams[2];

In this case, GNU's way makes libc work with compilers other than what
libc was compiled with.

This is not the first time I have seen NetBSD code use the C preprocessor
where GNU uses symbols.  Is there a reason for this?

Ben
  __
 (oO)  Why vote for the lesser of two evils?  Cthulhu for president.
 /||\