_BSD_SOURCE vs. __BSD_VISIBLE

Garrett Wollman wollman at khavrinen.lcs.mit.edu
Sat Mar 20 19:50:48 PST 2004


<<On Thu, 18 Mar 2004 17:31:28 -0600 (CST), Archie Cobbs <archie at dellroad.org> said:

> I want everything.. on Linux I need at least _GNU_SOURCE to get it,
> otherwise my compilation fails due to undeclared stuff. Why did Linux
> choose to arrange things so that the "default" is to not show everything?
> Don't just say they made a "bad decision".. they must have had some
> rationale, even if flawed.

Perhaps you should ask a Linux developer that question.  I can hardly
speak for them.

By my reading of the standard, if the application defines
_POSIX_C_SOURCE to a recognized value, then any system header files
included *must not* declare any symbols outside the namespaces
reserved in the Standard for those header files.  (If the application
defines _POSIX_C_SOURCE and then includes a non-Standard system header
file, all bets are off, and in many cases compilation will and ought
to break.)

If an application defines a macro in the implementation name space,
then the compiler is free to compile the module as an implementation
of `system("rogue");'.

-GAWollman



More information about the freebsd-standards mailing list