分类: LINUX
2012-09-25 10:02:34
Directive | Description |
#define | Defines a name as a macro that the preprocessor will expand in the code every place the name is used. |
#elif | Provides an alternative expression to be evaluated by an #if directive. |
#else | Provides an alternative set of code to be compiled if an #if, #ifdef, or #ifndef is false. |
#error | Produces an error message and halts the preprocessor. |
#if | Compiles the code between this directive and its matching #endif only if evaluating an arithmetic expression results in a nonzero value. |
#ifdef | Compiles the code between this directive and its matching #endif only if the named macro has been defined. |
#ifndef | Compiles the code between this directive and its matching #endif only if the named macro has not been defined. |
#include | Searches through a list of directories until it finds the named file; then it inserts the contents of the file just as if it had been inserted by a text editor. |
#include_next | The same as #include, but this directive begins the search for the file in the directory following the one in which the current file was found. |
#line | Specifies the line number, and possibly the file name, that is reported to the compiler to be used to create debugging information in the object file. |
#pragma | A standard method of providing additional information that may be specific to one compiler or one platform. |
#undef | Removes a definition previously created by a #define directive. |
#warning | Produces a warning message from the preprocessor. |
## | The concatenation operator, which can be used inside a macro to combine two strings into one. |
Macro | Description |
__FILE__ | A quoted string containing the name of the source file in which the macro is used. Also see __BASE_FILE__. |
__func__ | The same as __FUNCTION__. |
__FUNCTION__ | A quoted string containing the name of the current function. |
__GNUC__ | This macro is always defined as the major version number of the compiler. For example, if the compiler version number is 3.1.2, this macro is defined as 3. |
__GNUC_MINOR__ | This macro is always defined as the minor version number of the compiler. For example, if the compiler version number is 3.1.2, this macro is defined as 1. |
__GNUC_PATCHLEVEL__ | This macro is always defined as the revision level of the compiler. For example, if the compiler version number is 3.1.2, this macro is defined as 2. |
__GNUG__ | Defined by the C++ compiler. This macro is defined whenever both __cplusplus and __GNUC__ are also defined. |
__INCLUDE_LEVEL__ | An integer value specifying the current depth level of the include file. The value at the base file (the one specified on the command ine) is 0 and is increased by 1 inside each file input by an #include directive. |
__LINE__ | The line number of the file in which the macro is used. |
__NO_INLINE__ | This macro is defined as 1 when no functions are to be expanded inline, either because there is no optimization or inlining has been specifically disabled. |
__OBJC__ | This macro is defined as 1 if the program is being compiled as Objective-C. |
__OPTIMIZE__ | This macro is defined as 1 whenever any level of optimization has been specified. |
__OPTIMIZE_SIZE__ | This macro is defined as 1 if optimization is set for size instead of speed. |
__REGISTER_PREFIX__ | This macro is a token (not a string) that is the prefix for register names. It can be used to write assembly language that’s portable to more than one environment. |
__STDC__ | Defined as 1 to indicate that the compiler is conforming to standard C. This macro is not defined when compiling C++ or Objective-C, and it is also not defined when the-traditional option is specified. |
__STDC_HOSTED__ | Defined as 1 to signify a “hosted” environment (one that has the complete standard C library available). |
__STDC_VERSION__ | A long integer specifying the standards version number in terms of its year and month. For example, the 1999 revision of the standard is the value 199901L. This macro is not defined when compiling C++ or Objective-C, and it is also not defined when the -traditional option is specified. |
__STRICT_ANSI__ | Defined if and only if either -ansi or -std has been specified on the command line. It is used in the GNU header files to restrict the definitions to those defined in the standard. |
__TIME__ | A seven-character quoted string containing the time the program was compiled. It has the form "18:10:34". |
__USER_LABEL_PREFIX__ | This macro is a token (not a string) that is used as the prefix on symbols in assembly language. The token varies depending on the platform, but it’s usually an underscore character. |
__USING_SJLJ_EXCEPTIONS__ | This macro is defined as 1 if the mechanism for handling exceptions is setjmp and longjmp. |
__VERSION__ | The complete version number. There is no specific format for this information, but it will at least include the major and minor release numbers. |