From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3904 invoked by alias); 5 Dec 2001 21:52:11 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 3729 invoked from network); 5 Dec 2001 21:51:40 -0000 Received: from unknown (HELO geoffk.org) (205.180.231.50) by sources.redhat.com with SMTP; 5 Dec 2001 21:51:40 -0000 Received: (from geoffk@localhost) by geoffk.org (8.9.3/8.9.3) id NAA03838; Wed, 5 Dec 2001 13:51:16 -0800 To: Per Bothner CC: gcc@gcc.gnu.org Subject: Re: misleading statement in bugs.html#known References: <3C0E8E95.20202@bothner.com> Reply-to: Geoff Keating From: Geoff Keating Date: Wed, 05 Dec 2001 13:52:00 -0000 In-Reply-To: Per Bothner's message of "Wed, 05 Dec 2001 13:16:05 -0800" Message-ID: X-Mailer: Gnus v5.5/Emacs 20.3 X-SW-Source: 2001-12/txt/msg00241.txt.bz2 Per Bothner 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