🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fr.comp.lang.c
Article #17

Re: flux standard declares en lvalue !

#17
From: Laurent Deniau
Date: Wed, 05 Apr 2000 00:00
64 lines
3024 bytes
Horst Kraemer wrote:
> 
> On Tue, 04 Apr 2000 17:51:29 +0200, Laurent Deniau
> <Laurent.Deniau@cern.ch> wrote:
> 
> > Je ne sais si c'est un bug mais la version de gcc **egcs-2.91.66
> > 19990314/Linux (egcs-1.1.2 release)** sur architecture linux 2.2 (sur la
> > 2.0 tout est ok) declare les flux standards stdin, stdout et stderr comme
> > variables externes (/usr/include/stdio.h):
> 
> > /* Standard streams.  */
> > extern FILE *stdin;             /* Standard input stream.  */
> > extern FILE *stdout;            /* Standard output stream.  */
> > extern FILE *stderr;            /* Standard error output stream.  */
> 
> Pourquoi pas ?
> 
> > En consequence ces flux ne sont plus constants et peuvent etre modifies.
> > D'autre part, on ne peut plus faire (ce qui me gene le plus):
> 
> > FILE *file_err = stderr;
> 
> Tu parles d'une initialisitation sur "niveau fichier". Eh bien, m�me
> la norme c89 n'a jamais donn�e de garantie que cela soit possible.
> Elle dit que stdin, stderr et stout sont des "expressions" du type
> FILE*. Elle ne dit pas qu'il doit s'agir d'expressions constantes.
> Donc un LValue modifiable a toujours �t� legal pour stdin, stout et
> stderr.

Pour ne citer qu'elle:

The expressions stdin, stdout, and stderr have type FILE *, and their
values are established prior to the start of an application program to
certain standard text streams.
[...]
These expressions (parlant de stdxx) are not usually lvalues, and in any
case they should not be altered by assignment. The freopen function may be
used to change them.
[...]
The expressions stdin, stdout and stderr are often defined as addresses of
static or global stream descriptors:

extern FILE iob[FOPEN_MAX];
...
#define stdin  (&iob[0])
#define stdout (&iob[1])
#define stderr (&iob[2])


Et jusqu'a il y a peu, c'etait bien ce qu'il y avait dans
/usr/include/stdio.h et ca me convenait tres bien...

Qui croire ?

> --
> Horst

a+, ld.

-- 
[ Laurent Deniau -- Data Analysis and Signal Processing ]
[ CERN -- The European Laboratory for Particle Physics  ]
[ Laurent.Deniau@cern.ch - http://home.cern.ch/~ldeniau ]
[   -- One becomes old when dreams become regrets --    ]
Technical Details
Message-ID: <38EB0E65.C5CDC4AA@cern.ch>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <38EA0F81.14175F08@cern.ch> <38ea3e7a.178990280@news.btx.dtag.de>

Show Full Headers
Complete Article Headers
X-Google-Language: FRENCH,ASCII
X-Google-Thread: f9822,cf0ca10e654ef794
X-Google-Attributes: gidf9822,public
X-Google-Thread: 108d68,cf0ca10e654ef794
X-Google-Attributes: gid108d68,public
From: Laurent Deniau <Laurent.Deniau@cern.ch>
Subject: Re: flux standard declares en lvalue !
Date: 2000/04/05
Message-ID: <38EB0E65.C5CDC4AA@cern.ch>
X-Deja-AN: 606987862
Content-Transfer-Encoding: 8bit
References: <38EA0F81.14175F08@cern.ch> <38ea3e7a.178990280@news.btx.dtag.de>
X-Accept-Language: fr-FR, en
X-Sender: "Laurent Deniau" <@smtp.cern.ch>
Content-Type: text/plain; charset=iso-8859-1
X-Complaints-To: news@sunnews.cern.ch
X-Trace: sunnews.cern.ch 954928620 5203 (None) 137.138.107.116
Organization: CERN
Mime-Version: 1.0
Newsgroups: fr.comp.lang.c,cern.linux