home *** CD-ROM | disk | FTP | other *** search
-
- C pre-processor cheat sheet
-
- This file explains most of the C pre-processor directives,
- environment variables and predefined symbols.
-
-
- PREPROCESSOR DIRECTIVES:
- ------------------------
- #ident "<string>" [Ignored]
- #define <macro-definition> Define a macro or symbol.
- #include {"<file>" | <<file>>} Include a file.
- #line <integer> [<file>] Reset line number and, optionally the
- name of the current file.
- #undef <macro> Undefine a macro or symbol.
- #pragma <local-pragma> Do a locally defined function. Only
- pragmas defined:
- once Include file to be
- included once.
- #endif End of "if" construct.
- #ifdef <macro> "If" construct to be done only if
- macro is defined.
- #ifndef <macro> "If" construct to be done only if
- macro is not defined.
- #if <constant-expression> "If" construct to be done if
- expression is true. Allows the
- following constant-expressions:
- ?: Same as C construct.
- defined <xyz> Done if xyz defined.
- defined (<xyz>) Done if xyz defined.
- #elif <constant-expression> "else-if" construct.
- #else "else" construct.
- #sccs Done only if SCCS file?
-
-
- PREPROCESSOR ENVIRONMENT VARIABLES:
- -----------------------------------
- INCDIR Directory to search for include files.
- LIBDIR Directory to search for libraries.
-
-
- PREPROCESSOR PREDEFINED SYMBOLS:
- --------------------------------
- sgi
- unix
- __EXTENSIONS__ Extensions to ANSI C allowed (compiled with -xansi).
- _SVR3 Version of unix.
- SVR3 Version of unix. Could also be:
- unix, dmart, gcos, ibm, os, tss, SVR2
- mips Destination computer. Could also be:
- interdata, pdp11, u370, u3b, u3b5, u3b2,
- u3b20d, vax
- _MIPSEB
- MIPSEB
- host_mips Host computer.
- LANGUAGE Compiler being used.
- _LANGUAGE Compiler being used. Could also be:
- LANGUAGE_C, LANGUAGE_ASSEMBLY,
- LANGUAGE_PASCAL, LANGUAGE_FORTRAN
- lint Defined if running lint.
-
- __LINE__ Current line being compiled.
- __FILE__ Quoted file being compiled.
- __DATE__ Quoted date being compiled.
- __BASE_FILE__ Quoted base file being compiled. If files are
- included, this is the original file. Note that the
- symbol is not expanded until the line is actually
- compiled.
- __INCLUDE_LEVEL__ Level of include files.
- __VERSION__ Quoted version of compiler.
- __TIME__ Quoted time of compile.
- __STDC__ Defined if standard ANSI C compile without extensions.
-