From owner-freebsd-ports@FreeBSD.ORG Sat May 17 08:55:01 2003 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACFF137B401 for ; Sat, 17 May 2003 08:55:01 -0700 (PDT) Received: from falcon.midgard.homeip.net (h76n3fls20o913.telia.com [213.67.148.76]) by mx1.FreeBSD.org (Postfix) with SMTP id 5F25E43F85 for ; Sat, 17 May 2003 08:54:59 -0700 (PDT) (envelope-from ertr1013@student.uu.se) Received: (qmail 94552 invoked by uid 1001); 17 May 2003 15:54:57 -0000 Date: Sat, 17 May 2003 17:54:57 +0200 From: Erik Trulsson To: Jonathan Belson Message-ID: <20030517155457.GA94423@falcon.midgard.homeip.net> Mail-Followup-To: Jonathan Belson , ports@FreeBSD.org 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3EC6439F.5020700@witchspace.com> User-Agent: Mutt/1.5.4i cc: ports@FreeBSD.org Subject: Re: FreeBSD Port: pornview-0.2.0.p.1 X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 17 May 2003 15:55:02 -0000 On Sat, May 17, 2003 at 03:13:51PM +0100, Jonathan Belson wrote: > Erik Trulsson wrote: > >>From (a draft version of) the C99 standard: > > > > 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. -- Erik Trulsson ertr1013@student.uu.se