What is __USE_MISC macro used for?

__USE_MISC is defined in /usr/include/features.h on the condition:

#if defined _BSD_SOURCE || defined _SVID_SOURCE
# define __USE_MISC     1
#endif

__USE_MISC --> Define things common to BSD and System V Unix.

So it looks like your code wants to ensure that it's defined in any case even if both _BSD_SOURCE and _SVID_SOURCE are not defined (Since glibc 2.20, defining _DEFAULT_SOURCE enables __USE_MISC).

See feature test macros for more information.


__USE_MISC is an internal detail for how the implementation's headers handle "feature test macros" that direct the compiler as to what set of standard functions should be made available to the build. As Thiruvalluvar's answer indicates, it's set up (for internal use) by the library headers if your build wants a _BSD_SOURCE or _SVID_SOURCE configuration.

Your code/build should not be dealing with that macro directly; instead it should use the documented feature test macros. glibc's docs can be found here: http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html

Tags:

C

Glibc