Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 May 2003 17:54:57 +0200
From:      Erik Trulsson <ertr1013@student.uu.se>
To:        Jonathan Belson <jon@witchspace.com>
Cc:        ports@FreeBSD.org
Subject:   Re: FreeBSD Port: pornview-0.2.0.p.1
Message-ID:  <20030517155457.GA94423@falcon.midgard.homeip.net>
In-Reply-To: <3EC6439F.5020700@witchspace.com>
References:  <3EC53C6C.1040904@witchspace.com> <20030517121908.GA67369@rot13.obsecurity.org> <3EC62CC2.6090209@witchspace.com> <20030517130549.GA44928@falcon.midgard.homeip.net> <3EC63B78.6010203@witchspace.com> <20030517135217.GA88537@falcon.midgard.homeip.net> <3EC6439F.5020700@witchspace.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, May 17, 2003 at 03:13:51PM +0100, Jonathan Belson wrote:
> Erik Trulsson wrote:
>  >>From (a draft version of) the C99 standard:
> 
> <snip>
> 
> Aha, I didn't realise you were talking about ISO C - I still think
> in ANSI most of the time (being old enough to have studied K&R at
> university).

Bad choice of terms there.  The original ANSI C standard was adopted by
ISO and the language defined therein is also usually referred to as ISO C.
The term ISO C by itself is usually taken to refer to the 1990 C
standard from ISO (which is identical to the 1989 ANSI standard (apart
from the numbering of sections).)


> 
> >Besides, the only way I can think of to have stdin/stdout/stderr
> >available as expressions but not #define them is to have them as just
> >plain variables, and if that was the only option available I am sure
> >the standards committee would have written that.  So even with the wording
> >you give they *could* be macros, but might not necessarily have been.
> 
> Presumably they usually were in ANSI C, but not in ISO C (as required).

Possibly, but FreeBSD (at least) has had them as #defines since as far
back as the CVS history goes at least (i.e at least since 1994.) 
Solaris and NetBSD also has them as macros.

On a Linux installation they were defined in stdio.h as:

/* Standard streams.  */
extern FILE *stdin;             /* Standard input stream.  */
extern FILE *stdout;            /* Standard output stream.  */
extern FILE *stderr;            /* Standard error output stream.  */
/* C89/C99 say they're macros.  Make them happy.  */
#define stdin stdin
#define stdout stdout
#define stderr stderr


With that definition of stdin/stdout/stderr the code in pornview
happens to work.  I suspect that code wasn't tested on anything except
Linux.


A bit of Googling leads me to believe that they were required to be
macros in C89 as well, even though many implementations didn't define
them that way.
Unfortunately I don't have a copy of the original ANSI C standard so I
can't check what it says there.

> 
> >Not explicitly no, but if the pornview code was OK there wouldn't have
> >been many other options left.
> 
> Apart from my lovely #undef solution :-)

I don't think "lovely" is a word I will ever use to describe anything
involving #undef.  "Ugly" is the word that comes to mind when thinking
about any situation that would require the use of #undef.

> 
> I'll contact the author and explain the situation, someone else can
> look at/commit the patch you posted.



-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013@student.uu.se



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030517155457.GA94423>