public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: Per Bothner <per@bothner.com>
Cc: gcc@gcc.gnu.org
Subject: Re: misleading statement in bugs.html#known
Date: Wed, 05 Dec 2001 14:38:00 -0000	[thread overview]
Message-ID: <je8zchcmxp.fsf@sykes.suse.de> (raw)
In-Reply-To: <3C0E8E95.20202@bothner.com> (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..

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

  parent reply	other threads:[~2001-12-05 22:38 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
2001-12-06 12:33   ` Per Bothner
2001-12-06 15:48     ` Richard Henderson
2001-12-05 14:38 ` Andreas Schwab [this message]
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=je8zchcmxp.fsf@sykes.suse.de \
    --to=schwab@suse.de \
    --cc=gcc@gcc.gnu.org \
    --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).