C++ Config (predefined cross-platform macros)
As we know there is no standard way in compilers to standardize macros with compilers and different operating systems
So I created this library that contains standardized macros and built-in functions and more.
Contents :
-
Compiler
This section contains some macros that can detect 26 compiler and its version. -
Standard Library
This section contains some macros that can detect 3 standard libraries and its version. -
Platform
This section contains some macros that can detect 28 platform. -
Architecture
This section contains some macros that can detect 16 architecture and its info. -
Attributes
This section contains some macros that can detect 17 attribute. -
Compiler
See Online Test to test 5 different compiler's online.
/* Print compiler info */ cout << XEERX_COMPILER << endl; // ๐ "GCC" cout << XEERX_COMPILER_MAJOR << endl; // ๐ 12 cout << XEERX_COMPILER_MINOR << endl; // ๐ 1 cout << XEERX_COMPILER_PATCH << endl; // ๐ 0 cout << XEERX_COMPILER_VERSION << endl; // ๐ 201392128 /* Check for specific compiler using ID/Macro */ #ifdef XEERX_COMPILER_<ID> // for example <ID> = GCC ...
-
Standard Library
See Online Test to test 3 different stdlib's online.
/* Print stdlib info */ cout << XEERX_STDLIB << endl; // ๐ "GNU libstdc++" cout << XEERX_STDLIB_MAJOR << endl; // ๐ 2022 cout << XEERX_STDLIB_MINOR << endl; // ๐ 8 cout << XEERX_STDLIB_PATCH << endl; // ๐ 19 cout << XEERX_STDLIB_VERSION << endl; // ๐ 3859283987 /* Check for specific stdlib using ID/Macro */ #ifdef XEERX_STDLIB_<ID> // for example <ID> = GNU ...
-
Platform
See Online Test to test 3 different platform's online.
/* Print platform info */ cout << XEERX_PLATFORM << endl; // ๐ "Linux" cout << XEERX_PLATFORM_FAMILY << endl; // ๐ "POSIX" /* Check for specific platform using ID/Macro */ #ifdef XEERX_PLATFORM_<ID> // for example <ID> = LINUX ... /* Check for specific platform family using ID/Macro */ #ifdef XEERX_PLATFORM_FAMILY_<ID> // for example <ID> = POSIX /* this platform is belong from POSIX */ ...
-
Architecture
See Online Test to test 2 different architecture's online.
/* Print architecture info */ cout << XEERX_ARCH << endl; // ๐ "x86_64" cout << XEERX_ARCH_SIZE << endl; // ๐ 64 cout << XEERX_ARCH_ENDIAN << endl; // ๐ "LITTLE" /* Check for specific architecture using ID/Macro */ #ifdef XEERX_ARCH_<ID> // for example <ID> = XEERX_ARCH_X86_64 ... /* Check for specific architecture family using ID/Macro */ #ifdef XEERX_ARCH_FAMILY_<ID> // for example <ID> = X86 /* this architecture is belong from X86 */ ...
-
Attributes
XEERX_ATTR_INLINE XEERX_ATTR_HIDDEN XEERX_ATTR_DEPRECATED("old version") void func(int x, int y) ...
See User-Configuration and Utility-Macros for more information.