Annotation of coherent/a/usr/man/ALL/c_preprocessor, revision 1.1.1.1

1.1       root        1: 
                      2: 
                      3: C preprocessor               Overview              C preprocessor
                      4: 
                      5: 
                      6: 
                      7: 
                      8: Preprocessing  encompasses all tasks  that logically  precede the
                      9: translation  of a program.   The preprocessor  processes headers,
                     10: expands  macros, and  conditionally includes  or  excludes source
                     11: code.
                     12: 
                     13: ***** Directives *****
                     14: 
                     15: The C preprocessor recognizes the following directives:
                     16: 
                     17: 
                     18:          #iiff         Include code if a condition is true
                     19:          #eelliiff       Include code if directive is true
                     20:          #eellssee       Include code if preceding directives fail
                     21:          #eennddiiff      End of code to be included conditionally
                     22: 
                     23: 
                     24: 
                     25:     #iiffddeeff      Include code if a given macro is defined
                     26:     #iiffnnddeeff     Include code if a given macro is not defined
                     27: 
                     28: 
                     29: 
                     30:     #ddeeffiinnee     Define a macro
                     31:     #uunnddeeff      Undefine a macro
                     32:     #iinncclluuddee    Read another file and include it
                     33:     #lliinnee       Reset current line number
                     34: 
                     35: 
                     36: A preprocessing directive is always introduced by the `#' charac-
                     37: ter.  The  `#' must be  the first non-white space  character on a
                     38: line,  but it  may  be preceded  by  white space  and  it may  be
                     39: separated from the directive name  that follows it by one or more
                     40: white space characters.
                     41: 
                     42: ***** Preprocessing Operators *****
                     43: 
                     44: The  Standard defines  two operators that  are recognized  by the
                     45: preprocessor:  the  ``stringize'' operator  #,  and the  ``token-
                     46: paste'' operator ##.
                     47: 
                     48: The operator  # indicates  that the  following argument is  to be
                     49: replaced by  a string literal; this  literal names the preproces-
                     50: sing token that replaces the argument.  For example, consider the
                     51: macro:
                     52: 
                     53: 
                     54:     #define display(x) show((long)(x), #x)
                     55: 
                     56: 
                     57: When the preprocessor reads the line
                     58: 
                     59: 
                     60: 
                     61: 
                     62: 
                     63: 
                     64: COHERENT Lexicon                                           Page 1
                     65: 
                     66: 
                     67: 
                     68: 
                     69: C preprocessor               Overview              C preprocessor
                     70: 
                     71: 
                     72: 
                     73:     display(abs(-5));
                     74: 
                     75: 
                     76: it replaces it with the following:
                     77: 
                     78: 
                     79:     show((long)(abs(-5)), "abs(-5)");
                     80: 
                     81: 
                     82: The ##  operator performs ``token pasting'' --  that is, it joins
                     83: two tokens together, to create a single token.  For example, con-
                     84: sider the macro:
                     85: 
                     86: 
                     87:     #define printvar(x) printf("%d\n", variable ## x)
                     88: 
                     89: 
                     90: When the preprocessor reads the line
                     91: 
                     92: 
                     93:     printvar(3);
                     94: 
                     95: 
                     96: it translates it into:
                     97: 
                     98: 
                     99:     printf("%d\n", variable3);
                    100: 
                    101: 
                    102: In  the past,  token pasting  had been  performed by  inserting a
                    103: comment between the tokens to be pasted.  This no longer works.
                    104: 
                    105: ***** Predefined Macros *****
                    106: 
                    107: The  ANSI Standard  describes the following  macros that  must be
                    108: recognized by the preprocessor:
                    109: 
                    110: 
                    111:          _ _DDAATTEE_ _Date of translation
                    112:          _ _FFIILLEE_ _Source-file name
                    113:          _ _LLIINNEE_ _Current line within source file
                    114:          _ _SSTTDDCC_ _Conforming translator and level
                    115:          _ _TTIIMMEE_ _Time of translation
                    116: 
                    117: 
                    118: For more information on any one of these macros, see its entry.
                    119: 
                    120: ***** Conditional Inclusion *****
                    121: 
                    122: The preprocessor will  conditionally include lines of code within
                    123: a program.   The directives  that include code  conditionally are
                    124: defined in such a way that you can construct a chain of inclusion
                    125: directives to include exactly the material you want.
                    126: 
                    127: 
                    128: 
                    129: 
                    130: COHERENT Lexicon                                           Page 2
                    131: 
                    132: 
                    133: 
                    134: 
                    135: C preprocessor               Overview              C preprocessor
                    136: 
                    137: 
                    138: 
                    139: ***** Macro Definition and Replacement *****
                    140: 
                    141: The preprocessor performs  simple types of macro replacement.  To
                    142: define a macro, use the preprocessor directive #ddeeffiinnee _i_d_e_n_t_i_f_i_e_r
                    143: _v_a_l_u_e.    The  preprocessor  scans   the  translation   unit  for
                    144: preprocessor tokens that match identifier; when one is found, the
                    145: preprocessor substitutes value for it.
                    146: 
                    147: ***** cpp *****
                    148: 
                    149: Under COHERENT, C preprocessing  is done by the program cpp.  The
                    150: cc command runs  cpp as the first step in  compiling a C program.
                    151: cpp can also be run by itself.
                    152: 
                    153: cpp reads  each input file;  it processes directives,  and writes
                    154: its product on ssttddoouutt.
                    155: 
                    156: If the  -E option is  not used, cpp  also writes into  its output
                    157: statements of  the form #lliinnee _n _f_i_l_e_n_a_m_e, so  that the parser cc0
                    158: can  connect its  error  messages and  debugger  output with  the
                    159: original line numbers in your source files.
                    160: 
                    161: See the Lexicon entry on cpp for more information.
                    162: 
                    163: ***** See Also *****
                    164: 
                    165: C language, cc, cpp
                    166: 
                    167: 
                    168: 
                    169: 
                    170: 
                    171: 
                    172: 
                    173: 
                    174: 
                    175: 
                    176: 
                    177: 
                    178: 
                    179: 
                    180: 
                    181: 
                    182: 
                    183: 
                    184: 
                    185: 
                    186: 
                    187: 
                    188: 
                    189: 
                    190: 
                    191: 
                    192: 
                    193: 
                    194: 
                    195: 
                    196: COHERENT Lexicon                                           Page 3
                    197: 
                    198: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.