问题
I use some GNU extensions and realized that if I set gnu99 as C-standard to use, I can omit #define _GNU_SOURCE. Does gnu99 imply the _GNU_SOURCE or is it still safer to use it or mandatory to avoid problems?
回答1:
You should differentiate between language and library features; -std=gnu99 enables GNU language features, _GNU_SOURCE enables GNU library features.
I suggest you to define _GNU_SOURCE if you use any library features, so it's clear for readers of your code. Also, this might make things more obvios when your code is (not) compiling on a platform that provides GCC but not glibc.
来源:https://stackoverflow.com/questions/18676944/should-i-still-define-gnu-source-when-i-compile-with-std-gnu99