* remove "\r" nonsense
[mascara-docs.git] / C / the.ansi.c.programming.language / c.programming.notes / sx14e.html
blob4b2e4a8969d9dc147a1229ef707e0755bf175f07
1 <!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
2 <!-- This collection of hypertext pages is Copyright 1995, 1996 by Steve Summit. -->
3 <!-- This material may be freely redistributed and used -->
4 <!-- but may not be republished or sold without permission. -->
5 <html>
6 <head>
7 <link rev="owner" href="mailto:scs@eskimo.com">
8 <link rev="made" href="mailto:scs@eskimo.com">
9 <title>C Preprocessor</title>
10 <link href="sx14d.html" rev=precedes>
11 <link href="sx14f.html" rel=precedes>
12 <link href="sx14.html" rev=subdocument>
13 </head>
14 <body>
15 <H2>C Preprocessor</H2>
17 <p>If you're careful,
18 it's possible
19 (and
20 can be
21 useful)
22 to use <TT>#include</TT> within a header file,
23 so that you end up with ``nested header files.''
24 </p><p>It's possible to use <TT>#define</TT>
25 to define ``function-like'' macros
26 that accept arguments;
27 the expansion of the macro can therefore depend on the
28 arguments it's ``invoked'' with.
29 </p><p>Two special preprocessing operators <TT>#</TT> and <TT>##</TT>
30 let you control the expansion of macro arguments
31 in fancier ways.
32 </p><p>The preprocessor directive <TT>#if</TT> lets you conditionally
33 include (or, with <TT>#else</TT>, conditionally not include)
34 a section of code depending on some arbitrary compile-time expression.
35 (<TT>#if</TT> can also do the same macro-definedness tests
36 as <TT>#ifdef</TT> and <TT>#ifndef</TT>,
37 because the expression can
38 use
39 a <TT>defined()</TT> operator.)
40 </p><p>Other preprocessing directives are
41 <TT>#elif</TT>, <TT>#error</TT>,
42 <TT>#line</TT>, and <TT>#pragma</TT>.
43 </p><p>There are a few predefined preprocessor macros,
44 some required by the C standard,
45 others perhaps defined by
46 particular compilation environments.
47 These are useful for conditional compilation
48 (<TT>#ifdef</TT>, <TT>#ifndef</TT>).
49 </p><hr>
50 <p>
51 Read sequentially:
52 <a href="sx14d.html" rev=precedes>prev</a>
53 <a href="sx14f.html" rel=precedes>next</a>
54 <a href="sx14.html" rev=subdocument>up</a>
55 <a href="top.html">top</a>
56 </p>
57 <p>
58 This page by <a href="http://www.eskimo.com/~scs/">Steve Summit</a>
59 // <a href="copyright.html">Copyright</a> 1995, 1996
60 // <a href="mailto:scs@eskimo.com">mail feedback</a>
61 </p>
62 </body>
63 </html>