Reputation: 215193
Is there a way with feature test macros to have glibc expose GNU extensions (functions not specified in POSIX, and additional flag/argument macros for standard functions, like MAP_ANONYMOUS
), but still prefer POSIX semantics whenever the POSIX and GNU definitions conflict? I'm thinking things like basename
, strerror_r
, etc.
Upvotes: 2
Views: 347
Reputation: 239011
For the specific case of basename()
, including <libgen.h>
header gives you the XPG / POSIX definition.
MAP_ANONYMOUS
isn't a GNU extension (_GNU_SOURCE
), it's defined if either _BSD_SOURCE
or _SVID_SOURCE
is defined.
Upvotes: 1