Misunderstanding
#define _xopen_source
It's definitely not a simple macro definition.
It is an integral part of making the program conform to the system environment
Concept
The functions implemented by GLIBC in all or part of the specification are:
1.ISO C:C Language International standard.
2.POSIX: ISO/IEC 9945 (aka IEEE 1003) standard for the operating system.
3.Berkeley Unix:bsd and SunOS.
4.svid:v System Interface Description.
5.xpg:the X/open Portability Guide.
program, in order to achieve the above functions need to define the corresponding macro. As a second functional POSIX, _posix_source should be defined. Similar to _bsd_source, _svid_source, _xopen_source.
Other words:
#define _xopen_source
is to be able to use 5. The X/open portability Guide features.
[Practical Method]
There are two ways to use the above five functions:
1) specified in the CC command, such as: cc-d _posix_source file.c
2) Set the first line of the source program to: # define _posix_source 1
[What is _xopen_source? ]
Translation into Chinese is very lame, the original English interpretation is as follows:
Macro: _xopen_source
If You define this macro, functionality described in the X/open Portability Guide is included. This was a superset of the posix.1 and POSIX.2 functionality and in fact _posix_source and _posix_c_source are Automaticall Y defined.
As the unification of all unices, functionality only available in BSD and SVID are also included.
IF the macro _xopen_source_extended is also defined, even more functionality is available. The Exa functions would make
The role of #define _XOPEN_SOURCE in Linux programming