This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: _GNU_SOURCE, _BSD_SOURCE, and __FAVOR_BSD
Hi,
Mikel Ward wrote:
> If you want to get the full effect of _GNU_SOURCE but make the BSD
> definitions take precedence over the POSIX definitions, use this
> sequence of definitions:
>
> #define _GNU_SOURCE
> #define _BSD_SOURCE
> #define _SVID_SOURCE
>
> But AFAICT, the order is unimportant.
Yes, the order is unimportant. I think "sequence" is being used as a
rough synonym for "set".
> I was not relying on any difference, but was wondering what the best
> include order was for portability, and whether the documentation is
> correct.
For maximal portability to current platforms, one should use the POSIX
definitions and define _XOPEN_SOURCE. ;-) Defining _GNU_SOURCE,
_ALL_SOURCE, _BSD_SOURCE, _SGI_SOURCE, _XOPEN_SOURCE_EXTENDED, etc
tends to also be a good idea, since sometimes (out of date or broken)
C libraries will leave out a definition or two when certain feature
test macros are missing.
Hope that helps,
Jonathan