Today I had to use the
basename() function, and the
man 3 basename (here) gave me some strange message:
There are two different versions of basename() – the POSIX version described above, and the GNU version, which one gets after
I’m wondering what this
#define _GNU_SOURCE means: is it tainting the code I write with a GNU-related license? Or is it simply used to tell the compiler something like “Well, I know, this set of functions is not POSIX, thus not portable, but I’d like to use it anyway“.
If so, why not give people different headers, instead of having to define some obscure macro to get one function implementation or the other?
Something also bugs me: how does the compiler know which function implementation to link with the executable? Does it use this
#define as well?
Anybody have some pointers to give me?