6.3. The Compilers As the porting effort starts, differences in compiler locations and compiler options between HP-UX and Linux become apparent. Although the compilers on both HP-UX and Linux claim conformance or close conformance to ANSI and ISO standards, porting personnel may encounter platform-specific programming syntax differences. The use of compiler extensions and platform-specific features are common programming practices that require some effort when porting from HP-UX to Linux. When starting to work with the build environment, the first thing to check is the location of the compiler binaries. They differ in directory locations, as shown in Table 6-2. Table 6-2. HP-UX and Linux Compiler Comparison TableCompiler | HP-UX Path | Linux Path |
---|
ANSI C | /opt/ansic/bin/cc | /usr/bin/gcc | C89 | /opt/ansic/bin/c89 | /usr/bin/gcc -std=c89 | C++ | /opt/aCC/bin/aCC | /usr/bin/g++ |
To query the version of the GNU GCC installed on Linux, do one of the following: $ rpm --query -a | grep gcc gcc-c++-3.4.2-6.fc3 libgcc-3.4.2-6.fc3 gcc-3.4.2-6.fc3 To find out the full path to the directory in which gcc resides, run the following: $ type gcc gcc is hashed (/usr/bin/gcc) To find out what version of gcc is installed, do the following: $ gcc -version gcc (GCC) 3.3.3 (SUSE Linux) Copyright (C) 2003 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ gcc -version (fedora installation) gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3) Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 6.3.1. C Compiler Options By default, both the HP-UX C[10] compilers compile in extended ANSI mode, whereas the GNU C compiler compiles with C89 standards with some GNU extensions.[11] Porting personnel need to watch out for incompatibilities in syntax because there are no guarantees in the standard when the extended mode is used. [10] Starting with HP-UX 10.30 forward
[11] This is equivalent to -std=gnu89. Table 6-3 compares compiler switch options for HP-UX cc and its equivalent switch on GNU gcc. Table 6-3. HP-UX ANSI cc and gcc Compiler Switches Comparison TableHP cc Option[12] | GNU gcc Option[13] | Description |
---|
-A[a|c|e] | -ansi -std=standard | Specifies the degree of ANSI compliance. | -Bextern | None | Performs the same operation as +Oextern=sym1, sym2,sym3..., except that symbols are loaded from an existing file instead of being specified on the command line. | -Bhidden | None | Hides all the symbols including references, except for those prefixed with __declspec(dllexport), __declspec(dllimport). | -Bhidden_def | None | Hides all the symbols defined in the module except for those prefixed with __declspec(dllexport). | -c | -c | Compiles only; does not link. | -C | -C | Prevents the preprocessor from stripping comments. | -D_POSIX_C_ | -D_REENTRANT | Compiles with threads. | SOURCE=199506L | -lpthread | | -D_REENTRANT | | | -lpthread | | | or use -lcma | | | (for user threads) | | | -Dname | -Dname | Defines the preprocessor variable name with a value of 1. | -Dname=def | -Dname=def | Defines the preprocessor variable name with a value of def. | -dynamic | -Wl,-Bdynamic | Enables linking of PIC objects. | -E | -E | Performs preprocessing only with output to stdout. | -fast | None | Expands into a set of compiler options, which results in improved application runtime. Options included are +O3, +Onolooptransform, +Olibcalls, +FPD, +Oentryschedule, and +Ofastaccess. Any of these options can be overridden by placing a subsequent option after -fast on the command line. | -g | -g | Inserts information for the symbolic debugger in the object file. | -G | -pg | Inserts information required by the gprof profiler in the object file. | -Idir | -Idir | Inserts dir in the include file search path. | -lx | -lx | Links with libx.a depending on default library paths. | -Ldir | -Ldir | Links the libraries in dir before the libraries in the default search path. Adds default linker paths to one specified in the -L option before searching the default system library directories. | -Wl,-Lsearchdir | -Wl,-Lsearchdir | -Wl specifies a flag to pass on to the linker. In this case, the -L flag is passed on. This has the same effect as the -L option. | -n | -shared | Generates shareable code. | | -Bshareable | | -N | None | Generates unshareable code. | -noshared | -static | Creates statically bound executables. | | -Bstatic | | | -dn | | | -non_shared | | -ooutfile | -ooutfile | Places object modules in file outfile. | -O | -O2 | Optimizes at level 2. | -p | -p | Inserts information required by the prof profiler in the object file. | -P | None | Performs preprocessing only with output to the corresponding .i file. | -q | None | Marks the executable as demand-loadable. | -Q | None | Marks the executable as not being demand-loadable. | -S | -s | Strips the symbol table from the executable file. | -S | -S | Generates an assembly language source file. | -t x,name | None | Substitutes or inserts subprocess x with name. | -Uname | -Uname | Undefines name in the preprocessor. | -v | -v | Enables verbose mode. | None | -### | Shows each invoked component; do not execute. | -V | --version | Causes subprocesses to print version | -version | | information to stderr. | -w | -w | Suppresses warning messages. | -Wd,-a or +a | None | Omits HP-provided prefix files required by the linker. | -Wx, arg1 [,arg2,..,arg n] | -Wx, option | Passes the arguments to the subprocess x. | -y | None | Generates information used by the HP SoftBench static analysis tool. | -Y | None | Enables Native Language Support (NLS). | -z | Default (also see -fno-delete-null-pointer-checks-fdelete-null-pointer-checks) | Disallows runtime dereferencing of null pointers. | -Z | None | Allows dereferencing of null pointers at runtime. | +DAmodel | -b machine -moptions (if gcc is set up as a cross-compiler) | Generates object code for a specific version of the PA-RISC architecture. In the case of GCC, whichever platform it is, is set up for cross-compiling. | +DCapptype | None | Generates code for portable or embedded applications. | +DD32 | -mpa-risc-1-1 | Generates 32-bit code for PA1.1 architecture. | +DD64 (64-bit) | -mpa-risc-2-0 (32-bit) | Generates x-bit code for PA2.0 architecture. | +dfname | None | Specifies the profile database to use with profile-based optimization. | +DSmodel | None | Performs instruction scheduling for a specific implementation of PA-RISC. | +DOosname | None | Sets the target operating system for the compiler. | +e | None | Enables the following HP value-added features while compiling in ANSI C mode: sized enum, long long, long pointers, compiler-supplied defaults for missing arguments to intrinsic calls, and $ in identifier HP C extensions. | +ESfic | None | Compiles with inline fast indirect calls. | +ESconstlit | None | Introduces new default behavior. HP C now stores constant-qualified (const) objects and literals in read-only memory. | +ESlit | default | Places string literals and constants into read-only data storage. | +ESnolit | None | Disables +ESconstlit, causing HP C to no longer store literals in read-only memory. | +ESnoparmreloc | None | Disables parameter relocation for function calls. | +ESsfc | None | Replaces function pointer comparison millicode calls with inline code. | +f | None | Inhibits the promotion of float to double, except for function calls and returns. | +FPflags Example:+FPVZO | None | Controls floating-point traps. | +help | None | Launches a Web browser displaying an HTML version of the HP C/HP-UX online help. | +hugesize | None | Lowers the threshold for huge data. | +I | -fprofile-generate | Prepares the object code for profile-based optimization data collection. | +k | None | Generates long-displacement code sequences so that a program can reference large amounts of global data physically located in shared libraries. | +L | None | Enables any #pragma listing directives and the listing facility. | +m | None | Prints identifier maps in the source code listing. | +o | None | Prints hexadecimal code offsets in the source code listing. | +[no]objdebug | None | When used with -g, +objdebug leaves debug information in the object files. | +O[0|1|2|3|4] | -O[0|1|2|3|s] | Invokes the optimization level. | +P | -fprofile-generate-fprofile-use | Performs profile-based optimization. | +pgmname | None | Specifies the execution profile data set to be used by the optimizer. | +r | None | Inhibits the automatic promotion of float to double. | +sb | -fsigned-bitfields-fno-unsigned- bitfields | Makes bit fields signed by default in both 32- and 64-bit modes. | +ubytes | -falign-labels=n (align branch targets to a power of 2 boundary) | Controls pointer alignment where bytes is 1, 2, or 4. | +uc | -funsigned-char | Makes unqualified char data types unsigned. | +wn | -Woptions (close equivalent) -Wall (turns on all warning messages) | Specifies the level of the warning messages, where n is 13 (HP-UX). | +W n1[,n2,...nN] | -Wnooptions (close equivalent) | Suppresses the specified warnings. | +Wen1[,n2,...nN] | -Werror (all warnings, close equivalent) -pendantic | Changes the specified warnings to errors. | +Wwn1[,n2,...nN] | -Woptions (close equivalent) | Enables the specified warnings, assuming all other warnings are suppressed with -w or +w3. | +z | -fpic | Generates shared library object code (same as +Z in 64-bit mode). | +Z | -fPIC | Generates shared library object code with a large data linkage table (long-form PIC). |
[12] HP C/HP-UX Online Help for HP-UX 11i (HP-UX 11.0, HP-UX 11i v1, HP-UX 11i v2) (http://docs.hp.com/hpux/onlinedocs/dev/C/B3901BA/c_index.html)
[13] GNU Compiler Collections version 3.4.2 (last updated May 23, 2004) 6.3.2. C++ Compiler Options HP-UX aCC claims to conform to the ISO/IEC 14882 standard for the C++ programming language, whereas GNU C++ claims to be much closer to full conformance to the ISO/ANSI C++ standard. Table 6-4 compares compiler switch options for HP-UX aC++ and its equivalent switch on GNU g++. Table 6-4. HP-UX aCC and g++ Compiler Switches Comparison TableHP aCC Option[14] | GNU g++ Option[15] | Description |
---|
-.suffix | None | The suffix parameter represents the character or characters to be used as the output filename suffix. | -Aa | -ansi -std=standard | Instructs the compiler to use Koenig lookup and strict ANSI for scope rules. | -AA | -std=c++98 (closest option found) | Conforms to the ISO C++ standard. | -AC89 | -std=c89 | Invokes the compiler in ANSI C89 compilation mode. | -AC99 | -std=c99[16] (also invoke -pendantic flag to receive all diagnostics) | Invokes the compiler in ANSI C99 compilation mode with its features. | -Ae | -std=gnu89 | Invokes as an ANSI C compiler, with additional support for HP C or GNU language extensions. | -AOa -AOe | -std=iso9899:1990 -std=iso9899:199409 (invoke with -Ox flag for optimization options) | In addition to specifying the ANSI C language dialect, allows the optimizer to aggressively exploit the assumption that the source code conforms to the ANSI programming language C standard ISO 9899:1990. | -AP | None | Turns off -AA mode and uses the older C++ runtime libraries. | -b | None | Creates a shared library rather than an executable file. | -c | -c | Compiles one or more source files but does not enter the linking phase. | -C | -C | Prevents the preprocessor from stripping comments. | -dynamic | -Wl,-Bdynamic | Produces dynamically bound executables. | -Dname[=def] | -Dname=def | Defines a symbol name (name) to the preprocessor, as if defined by the preprocessing directive #define. | +d | -fno-default-inline (close but not exact) -fno-inline | Prevents the expansion of inline functions. | +dryrun | -### | Displays the options passed, but does not execute. | -ext +e | None | Enables platform-dependent C++ standards extensions. | -E | -E | Runs only the preprocessor on the named C++ files and sends the result to standard output (stdout). | -fast | None | Selects a combination of optimization options for optimum execution speed for reasonable build times. | -fpeval= precision | None | Specifies the minimum precision to use for floating-point expression evaluation. | -g[0|1] | -g[1|2|3] | Emits different levels of debug information. | -G | -pg | Compiles and creates the executable file instrumented for use with gprof. | -Idirs -I- | -I | Indicates an optional list of -Idirectory specifications. | -mt | -D_REENTRANT -lpthread | Compiles multithreading. | -n | -shared -Bshareable | Causes the program file produced by the linker to be marked as sharable. | -N | None | Causes the program file produced by the linker to be marked as unsharable. | -ooutfile | -ooutfile | Causes the output of the compilation to be placed in outfile. | -O | -O2 | Invokes the optimizer to perform level 2 optimizations. | -p | -p | Compiles and creates the executable file instrumented for use with prof. | -P | None | Only preprocesses the files named on the command line without invoking further phases. Leaves the result in corresponding files with the suffix .i. | -q | None | Causes the output file from the linker to be marked as demand-loadable. | -Q | None | Causes the program file from the linker to be marked as not demand-loadable. | -r | -r | Retains relocation information in the output file for subsequent relinking. | -s | -Wl,-s | Causes the executable program file created by the linker to be stripped of symbol table information. | -S | -S | Compiles the named program and leaves the assembly language output in a corresponding file with a .s suffix. | -Uname | -u -undefined=symbol | name is the symbol name whose definition is removed from the preprocessor. | -v | -v | Enables verbose mode, sending a step-by-step description of the compilation process to stderr. | -V -version | --version | Displays the version numbers of the current compiler and linker (if the linker is executed). | -w | -w | Suppresses all warning messages. | -Wc,-ansi_for_ scope,[on][off] | -ffor-scope-fno-for-scope | Enables or disables the standard scoping rules for init declarations in for statements. | -Wc,-koenig_ lookup,[on][off] | None | Enables or disables standard argument-dependent lookup rules (also known as Koenig lookup). | -Wx, arg1 [,arg2,..,argn] | -Wx, arg1 [,arg2,..,argn] | Passes the arguments arg1 tHRough argn to the subprocess x of the compilation. | -Y | None | Enables Native Language Support (NLS) of 8-bit, 16-bit, and 4-byte EUC characters in comments, string literals, and character constants. | -z | Default | Disallows dereferencing of null pointers at runtime. | -Z | None | Allows dereferencing of null pointers at runtime. | +help | None | Invokes the initial menu window of the HP aC++ online programmer's guide. | +ild | -Wl,-i | Specifies incremental linking. | +noeh | None | Disables exception handling. | +nostl | None | Eliminates references to the standard header files and libraries bundled with HP aC++. | +O[no]initcheck | -Wuninitialized -O | The initialization checking feature. | +sb | None | Specifies unqualified char/short/int/long/long long bit fields as signed. | +tls=[static|dynamic | -ftls-model=model | Specifies whether references to thread local data items are to be performed according to the mode. | +ub | None | Specifies unqualified char/short/int/long/long long bit fields as unsigned. | +uc | None | Specifying +uc causes an unqualified (plain) char data type to be treated as unsigned char. | +Warg1 [,arg2,..argn] | None | Selectively suppresses any specified warning messages, where arg1 tHRough argn are valid compiler warning message numbers. | +We | -Werror | Interprets all warning and future error messages as errors. | +Wearg1 [,arg2,..argn] | None | Selectively interprets any specified warning or future error messages as errors. arg1 through argn are valid compiler warning message numbers. | +Wwarg1 [,arg2,..argn] | None | Selectively treats compiler warnings as warnings. arg1 through argn are valid compiler message numbers. | -Wl,+FPVZO | None | Hardware trap FPEs. |
[14] HP aC++ version A.05.50 Programmer's Guide (HP-UX 11i v2) (http://docs.hp.com/hpux/onlinedocs/4310/index.htm)
[15] GNU Compiler Collections version 3.4.2 (last updated May 23, 2004)
[16] GCC has incomplete support for C99. See http://gcc.gnu.org/gcc-3.4/c99status.html. 6.3.3. Template Instantiation in GNU g++ According to the document "Using the GNU Compiler Collection,"[17] the GNU g++ compiler provides two automated approaches to template instantiation: the Borland and the Cfront model.[18] On platforms other than the Linux on IA, g++ implements neither automatic instantiation approach. For all applications that use template instantiation to be ported to Linux, the best approach is to modify the code to include template definitions to make them available at one or more points of instantiation; usually this is as simple as adding #include <temp_methods.c> to the end of each template header (see Examples 6-1, 6-2, and 6-3). [17] Last updated May 23, 2004, for GCC 3.4.2.
[18] Refer to the GCC online manual at http://gcc.gnu.org/onlinedocs/ for definitions of Borland and Cfront models. Example 6-1. Listing of main.C #include "stack.h" int main() { Stack<int, 60> s; int j; int i; s >> j; s << j; i = j; return (0); } | Example 6-2. Listing of stack.h #ifndef STACK_INCLUDED #define STACK_INCLUDED typedef enum{tr, fl} Bool; template<class Item, int size> class Stack { public: int operator << (Item item); int operator >> (Item& item); Stack(Bool p=fl) {top = 0;} private: Item stack[size]; int top; }; #endif /* STACK_INCLUDED */ | Example 6-3. Listing of stack.C #include "stack.h" template<class Item, int size> int Stack<Item, size>::operator << (Item item) { if (top >= size) return 0; stack[top++] = item; return 1; } template <class Item, int size> int Stack<Item, size>::operator >> (Item& item) { if(top<=0) return 0; item = stack[--top]; return 1; } | When compiled on HP-UX with the aCC compiler, the files of main.C, stack.C, and stack.h produce an executable without compile errors when using the +inst_implicit_include flag: [View full width] $ aCC +inst_implicit_include[19] -o test main.C $ ./main
[19] Refer to "Using Templates in HP aC++," September 27, 1997, available from http://docs.hp.com. When compiled on Linux using g++, it results in the following compiler error: $ g++ -o main main.C /tmp/ccicEJmr.o(.text+0x45): In function 'main': : undefined reference to 'Stack<int, 60>::operator>>(int&)' /tmp/ccicEJmr.o(.text+0x5d): In function 'main': : undefined reference to 'Stack<int, 60>::operator<<(int)' collect2: ld returned 1 exit status The problem here is that when Stack was instantiated, the definitions for operators << and >> could not be found, and thus the error. The preceding g++ compiler error is corrected by modifying stack.h to include stack.C, as shown in Example 6-4. Example 6-4. Listing of Modified stack.h #ifndef STACK_INCLUDED #define STACK_INCLUDED typedef enum{tr, fl} Bool; template<class Item, int size> class Stack { public: int operator << (Item item); int operator >> (Item& item); Stack(Bool p=fl) {top = 0;} private: Item stack[size]; int top; }; #include "stack.C" /* include stack.C */ #endif /* STACK_INCLUDED */ | Then compile with g++: $ g++ -o main main.C As mentioned earlier, modifying the code to include template definitions makes these definitions available at one or more points of instantiation, avoiding the error encountered earlier. 6.3.4. Building 32- or 64-Bit Binaries Table 6-5 compares compiler switch options for HP-UX compilers and the equivalent switch on GNU for creating 32- and 64-bit binaries. Table 6-5. HP-UX and Linux Compiler Build Switches for Platform-Dependent BuildsHP Option | HP Description | GNU Option | GNU Description |
---|
+DD32 | 32 (generates ILP32 code and is the default) | -m32 (platforms other than IA32) Default on IA32 | 32 (generates ILP32 code) | +DD64 | 64 (generates LP64 code) | -m64 (AMD x86-64 code) | 64 (generates LP64 and AMD x86-64 code) |
Refer to Chapter 3, "Analysis," for more information about 32-to-64-bit migration. 6.3.5. Compiler Optimization and Performance Options Table 6-6 compares compiler switch options for HP-UX and its equivalent switch on GNU for optimizing executables. Table 6-6. HP-UX and Linux Compiler Optimization SwitchesHP-UX Option | HP-UX Description | GNU Level | GNU Description |
---|
+O0 | Constant folding and simple register assignment. Compiles fastest. | -O0 | Does not optimize. This is the default. | +O1 | Performs level 1 optimization only. This includes branch optimization, dead code elimination, faster register allocation, instruction scheduling, and peephole optimization. This is the default optimization level. | -O -O1 | Tries to reduce code size and execution time without performing optimization that takes a great deal of compilation time. Merges constants, optimizes jump instructions, transforms conditional jumps to branchless equivalents, and attempts to reorder instructions to optimize execution stalls. | +O2 or -O | Optimizations performed over entire functions in a single file. Optimizes loops to reduce pipeline stalls. Performs scalar replacement and analysis of data flow, memory usage, loops, and expressions. Can produce faster runtime code than level 1 if programs use loops extensively. | -O2 | Optimizes better than -O. Performs optimization that does not require size-speed trade-off. Increases compilation time and application performance. Turns on all optimization flags specified in -O. Forces memory operands to be copied into registers before doing arithmetic on them. Scans jump instructions when target of jump is not reached by any other path. Performs loop optimization. Enables peephole2 optimization. Aligns start of functions and branch targets. | +O3 | Full optimization across all Full optimization across all subprograms within a single file. Includes subprogram inlining. Can produce faster runtime code than level 2 on code that frequently calls small functions. Links faster than level 4. | -O3 | Turns on all optimization specified in -O2. Integrates simply functions into their callers. Makes use of registers left over after register allocation. | +O4 | Performs level 4 optimization. This includes level 3 optimization. Plus full optimizations across the entire application program. Note: Object files produced at this level are intended to be temporary. Hewlett-Packard reserves the right to change the format of these files without prior notice. There is no guarantee that intermediate object files will be compatible from one revision of the compiler to the next. | -Os | Optimizes for size. Enables -O2 optimization properties that do not increase code size. |
6.3.6. Porting and Compiling Using GNU When compiling an application, several predefines can be used to turn features on or off, depending on the platform and environment that application will run on. The GNU gcc predefines some default definitions, and it is important to know what they are. Be aware that different installations of Linux may have different predefines for the GNU compiler. To find out what gcc "predefines" during compile time, issue the following command from the command line: $ echo 'main(){printf("hello world\n");}' | gcc -v -E - Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c, c++,f77, objc,java, ada --disable-checking --libdir=/usr/lib --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux Thread model: posix gcc version 3.3.3 (SuSE Linux) /usr/lib/gcc-lib/i586-suse-linux/3.3.3/cc1 -E -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 - #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc-lib/i586-suse-linux/3.3.3/include /usr/i586-suse-linux/include /usr/include End of search list. # 1 "<stdin>" # 1 "<built-in>" # 1 "<command line>" # 1 "<stdin>" main(){printf("hello world\n");} In this particular example, the predefined variables are as follows: -D__GNUC__=3 -D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=3 To define default variables for this installation, the file usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs can be edited to add more predefined variables. Another way to define variables during compile time is by using the -D<variable_name> switch to the appropriate build flags in the makefiles. 6.3.7. Namespace Selection on Linux Platform Linux header files and libraries offer support for several namespaces for different types of standards compliance. They are described in Table 6-7. Table 6-7. Linux Namespace TableLinux Definitions[20] | Description |
---|
__STRICT_ANSI__ | ISO Standard C. | _ISOC99_SOURCE | Extensions to ISO C89 from ISO C99. | _POSIX_SOURCE | IEEE Std 1003.1. | _POSIX_C_SOURCE | If ==1, like _POSIX_SOURCE; | | if >=2, add IEEE Std 1003.2; | | if >=199309L, add IEEE Std 1003.1b-1993; | | if >=199506L, add IEEE Std 1003.1c-1995; | | if >=200112L, all of IEEE 1003.1-2001. | _XOPEN_SOURCE | Includes POSIX and XPG things. Set to 500 if Single UNIX Specification version 2 conformance is wanted, to 600 if SUSv3. | _XOPEN_SOURCE_EXTENDED | XPG things and X/Open UNIX extensions. | _LARGEFILE_SOURCE | Some more functions for correct standard I/O. | _LARGEFILE64_SOURCE | Additional functionality from LFS for large files. | _FILE_OFFSET_BITS=N | Select default filesystem interface. | _BSD_SOURCE | ISO C, POSIX, and 4.3BSD things. | _SVID_SOURCE | ISO C, POSIX, and SVID things. | _GNU_SOURCE | All of the above, plus GNU extensions. | _REENTRANT | Select additionally reentrant object. | _ThrEAD_SAFE | Same as _REENTRANT; often used by other systems. | _FORTIFY_SOURCE | If set to numeric value > 0, additional security measures are defined, according to level. |
[20] Taken from /usr/include/features.h Namespace definitions provide a way to check what level of support is provided on the Linux installation. For example, an application can check to see whether the installation conforms to SUSv3 by checking the value of _XOPEN_SOURCE. If it does not conform to SUSv3, it can execute a different path. |