From: Geoff Keating <geoffk@geoffk.org>
To: Per Bothner <per@bothner.com>
Cc: gcc@gcc.gnu.org
Subject: Re: misleading statement in bugs.html#known
Date: Wed, 05 Dec 2001 13:52:00 -0000 [thread overview]
Message-ID: <jmitblz67i.fsf@geoffk.org> (raw)
In-Reply-To: Per Bothner's message of "Wed, 05 Dec 2001 13:16:05 -0800"
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..
Actually, neither of these are the real reason. I believe the
definition of stdin was changed so that user programs didn't need to
know the size of 'FILE'. If a user program writes
printf (&__stdin, ...)
then this works with dynamic linking by creating space in the
executable for '__stdin', resolving the address of __stdin at link
time, and copying at startup time the initial contents of __stdin to
that space (this is done because addresses in applications are not
resolved at run time). If __stdin grows in size in future glibc
versions, the space reserved in old applications will be too small,
and special compatibility code is required. So instead, 'stdin' is
made a variable of type 'FILE *', which is not likely to change in
size in future versions.
--
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>
next prev parent reply other threads:[~2001-12-05 21:52 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-05 13:16 Per Bothner
2001-12-05 13:52 ` Geoff Keating [this message]
2001-12-06 12:33 ` Per Bothner
2001-12-06 15:48 ` Richard Henderson
2001-12-05 14:38 ` Andreas Schwab
2001-12-06 4:31 ` Gerald Pfeifer
2001-12-06 4:46 ` Andreas Schwab
2001-12-06 7:18 ` Gerald Pfeifer
2001-12-06 7:35 ` Andreas Schwab
2001-12-06 10:08 ` Gerald Pfeifer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jmitblz67i.fsf@geoffk.org \
--to=geoffk@geoffk.org \
--cc=gcc@gcc.gnu.org \
--cc=geoffk@redhat.com \
--cc=per@bothner.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).