Subject: Re: src/gnu/usr.bin/egcs/common
To: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-userlevel
Date: 12/22/1999 10:04:26
On Tue, 21 Dec 1999 15:18:17 -0500
Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us> wrote:
> > At least, ANSI/ISO-C permits that stdin/stdout/stderr are
> > variable (not constant), thus, programs which are doing (A)
> > are not portable, from the ANSI/ISO-C point of view.
>
> True. But we could avoid breaking such programs with something like:
>
> extern FILE __sFstdin[], __sFstdout[], __sFstderr[];
>
> #define stdin __sFstdin[0]
> #define stdout __sFstdout[0]
> #define stderr __sFstderr[0]
The trick is to make sure these are referenced as pointers... you don't
want to incur a copy relocation, which screws you when you change the
size of the object.
-- Jason R. Thorpe <thorpej@nas.nasa.gov>