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.
Is there a way with feature test macros to have glibc expose GNU extensions
Share
For the specific case of
basename(), including<libgen.h>header gives you the XPG / POSIX definition.MAP_ANONYMOUSisn’t a GNU extension (_GNU_SOURCE), it’s defined if either_BSD_SOURCEor_SVID_SOURCEis defined.