This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: misleading statement in bugs.html#known
- From: Andreas Schwab <schwab at suse dot de>
- To: Per Bothner <per at bothner dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 05 Dec 2001 23:38:26 +0100
- Subject: Re: misleading statement in bugs.html#known
- References: <3C0E8E95.20202@bothner.com>
Per Bothner <per@bothner.com> writes:
|> The bugs.html files says 'FILE *yyin = stdin' "will not compile with GNU
|> libc (GNU/Linux libc6), because stdin is not a constant. This was done
|> deliberately, in order for there to be no limit on the number of open FILE
|> objects."
|>
|> The latter has nothing to do with it. It is easy to make stdin be
|> a constant while still having no limit on the number of open FILE
|> objects. For example:
|>
|> extern FILE __stdin;
|> @define stdin (&__stdin)
|>
|> The point is that glibc allows you to *assign* to stdin, so it is
|> no longer constant. This is a questionable feature..
No. The real reason is that using the address of a static object is a
nightmare in context of maintaining binary compatibility. Platforms that
use copy relocations will lose if the size of the FILE type changes.
In any way, the C standard does not *require* stdin to be a constant.
Thus using it as an initializer at file scope is broken no matter what.
Andreas.
--
Andreas Schwab "And now for something
Andreas.Schwab@suse.de completely different."
SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5