Subject: Re: CVS commit: pkgsrc/security/AiSSLtelnet
To: None <>
From: Joerg Sonnenberger <>
List: tech-pkg
Date: 07/19/2005 21:09:45
On Tue, Jul 19, 2005 at 03:45:37PM +0200, Rhialto wrote:
> On Tue 19 Jul 2005 at 14:52:14 +0200, Jeroen Ruigrok/asmodai wrote:
> > #include <errno.h>
> > 
> > #ifndef(errno)
> > extern int errno;
> > #endif
> That won't work. #if(n)def is a preprocessor construct, that knows
> nothing about C declarations, only about preprocessor macros.
> Anyway, after #include <errno.h> no declaration of errno is needed
> anyway (and probably isn't even allowed).

It is needed for old platforms, at least that's what I've been told.

> This common-sense observation is backed up by the C99 draft (the best
> reference I have available here) says in 7.5 "It is unspecified whether
> errno is a macro or an identifier with external linkage. If a macro
> definition is suppressed in order to access an actual object, or a
> program defines an identifier with the name errno, behaviour is
> undefined."

I know, but the macro check is the greatest portable thing if you still
want to support obscure platforms. The more interesting part here is
that "extern int errno;" is nasty and involves all kind of strange
problems for more advanced thread libraries, where errno is not a simple
variable. For example, the common definition of
#define errno *__error()
results in multiple prototypes for __error, one with ANSI style and one
with K&R style. I would argue that a good compiler should at least warn
about that, if not reject it.