Subject: Re: Solaris like __EXTENSIONS__ ?
To: Ben Harris <>
From: Marc Recht <>
List: tech-userlevel
Date: 04/21/2003 16:58:23
>> FreeBSD 5 has something like set, too. They're setting a __BSD_VISIBLE
> That seems a little silly, since that conflicts with the way that other
> feature-test macros work.  You're explicitly allowed to define both
> _POSIX_C_SOURCE and _XOPEN_SOURCE, for instance, and that's equivalent to
> defining _XOPEN_SOURCE on its own.
You're allowed to do that on FreeBSD, but then __BSD_VISIBLE isn't set. 
__BSD_VISIBLE itself is used like __EXTENSIONS__ on Solaris, to override 
the "if POSIX" stuff. (But, unlike __EXTENSIONS__ it isn't supposed to be 
set by the developer.)

> We could arrange that setting _NETBSD_SOURCE to 1 (or empty) caused it to
> default to the latest version, but yes, that might be a bit complex.  The
> problem is that without it, there's no way an application setting
> _NETBSD_SOURCE can be sure we won't arbitrarily trample some bit of their
> namespace in a future version.  If they can say "I'm happy for you to
> trample the parts of my namespace that you used in version 1.6, but no
I think of _NETBSD_SOURCE of something like "give me all the system has to 
offer" and that changes a bit from OS version to OS version.

> more", this problem is avoided.  I suspect that most application authors
> would find this all too confusing, though.
I don't think so. Solaris and Linux handle it that way, so that most 
developers should know that concept.

> You don't.  My point was that Python shouldn't _need_ to set
> _NETBSD_SOURCE, because the fact that it's including <rpc/types.h>
> indicates that it wants an extension to POSIX, since that header doesn't
> exist in POSIX.  Unfortunately, actually implementing this is probably
> more trouble than it's worth.
Ah. I see. I think that would be too much "magic".

> Having to define _NETBSD_SOURCE is hardly "just working".
It also works if I don't define anything. The problem only occurs if I want 
to set a POSIX std., but still want extensions to it.

>> For the Python RPC case this would be enough:
>># if defined(_NETBSD_SOURCE) || (!defined(_POSIX_SOURCE) &&
>> !defined(_XOPEN_SOURCE))
> Actually, I'd like that to be:
># if defined(_NETBSD_SOURCE)
> with _NETBSD_SOURCE being defined by <sys/featuretest.h> if none of the
> other macros is defined.
But won't that break (stricly) POSIX conforming applications which set 
POSIX* ? But, don't (and don't want to) know about OS extensions?


mundus es fabula