C-predefined macros commonly used

Source: Internet
Author: User

Pre-defined macros
__date__ string, date of preprocessing ("MMM dd yyyy", if May 27 2006)
__time__ string, the compile time of the source file ("Hh:mm:ss", such as 09:11:10)
__file__ string representing the current source code file name (including a detailed path, such as F:/A.C)
__line__ integer value representing the line number in the current source code file
__stdc__ Boolean value that indicates that the implementation strictly complies with the ANSIC standard
__stdc_version__ Long Integer value that represents the version number of the C standard that the compiler follows (YYYYMML, such as 199101L)
__func__ string, current function name (C99 standard)
__function__ string, same as __func__, not recommended
__pretty_function__ in C, with __func__; In C + +, the header information for the current function is recorded
__VA_ARGS__ saved the variable parameter list "..."
__cplusplus Long Integer value that represents the version number of C + + (YYYYMML, such as 199711L)

/*/char *creationdate = __date__",""  $s%d%d,%d:%d:%d", Month, &day, &year, &hour, &min, &sec);


OS Macro
Windows: _win32, WIN32, _win64
Unix:unix, __unix, __unix__
Linux:linux, __linux, __linux__, __gnu_linux__
Sunos/solaris: __SVR4, __svr4__, Sun, __sun, __sun__, SPARC, __sparc, __sparc__
Hpux: __hppa, __hppa__, __hpux, __hpux__, _hupx_source
AIX: _aix, _aix32, _aix41, _aix43, _aix51, _aix52
CPU: __x84_64, __x86_64__, __amd64, __amd64__, SPARC, __sparc, __sparc__

Comiler Macro
__stdc__: Boolean value of 1 o'clock, indicating compatibility with Ansic standard
__gnuc__: Integer value, a predefined macro for the GCC compiler that represents the major version number of GCC
__gnuc_minor__: integer value, gcc minor version number
__gnuc_pathlevel__: integer value, gcc revision number
__glibc__: Integer value, major version number of glib
__glibc_minor__: Integer value, minor version number of glib

For example gcc3.4.5 version, then __gnuc__==3, __gnuc_minor__==4, __gnuc_pathlevel__==6

C-predefined macros commonly used

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.