What does “#define _GNU_SOURCE” imply?

后端 未结 4 928
梦毁少年i
梦毁少年i 2020-11-27 09:53

Today I had to use the basename() function, and the man 3 basename (here) gave me some strange message:

Notes

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-27 10:23

    From some mailing list via google:

    Look at glibc's include/features.h:

    _GNU_SOURCE All of the above, plus GNU extensions.

    Which means it enables all this:

    STRICT_ANSI, _ISOC99_SOURCE, _POSIX_SOURCE, _POSIX_C_SOURCE, _XOPEN_SOURCE, _XOPEN_SOURCE_EXTENDED, _LARGEFILE_SOURCE, _LARGEFILE64_SOURCE, _FILE_OFFSET_BITS=N, _BSD_SOURCE, _SVID_SOURCE

    So it enables a whole lot of compiling flags for gcc

提交回复
热议问题