FreeBSD Port: pornview-0.2.0.p.1

Erik Trulsson ertr1013 at student.uu.se
Sat May 17 08:55:02 PDT 2003


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 at student.uu.se


More information about the freebsd-ports mailing list