R.. GitHub STOP HELPING ICE
R.. GitHub STOP HELPING ICE

Reputation: 215193

Requesting GNU extensions but otherwise POSIX-conformant functions?

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

Answers (1)

caf
caf

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

Related Questions