1<html lang="en"> 2<head> 3<title>The C Preprocessor</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="The C Preprocessor"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="#Top"> 8<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 9<!-- 10Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 111997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 122008, 2009, 2010, 2011 13Free Software Foundation, Inc. 14 15Permission is granted to copy, distribute and/or modify this document 16under the terms of the GNU Free Documentation License, Version 1.3 or 17any later version published by the Free Software Foundation. A copy of 18the license is included in the 19section entitled "GNU Free Documentation License". 20 21This manual contains no Invariant Sections. The Front-Cover Texts are 22(a) (see below), and the Back-Cover Texts are (b) (see below). 23 24(a) The FSF's Front-Cover Text is: 25 26 A GNU Manual 27 28(b) The FSF's Back-Cover Text is: 29 30 You have freedom to copy and modify this GNU Manual, like GNU 31 software. Copies published by the Free Software Foundation raise 32 funds for GNU development. 33--> 34<meta http-equiv="Content-Style-Type" content="text/css"> 35<style type="text/css"><!-- 36 pre.display { font-family:inherit } 37 pre.format { font-family:inherit } 38 pre.smalldisplay { font-family:inherit; font-size:smaller } 39 pre.smallformat { font-family:inherit; font-size:smaller } 40 pre.smallexample { font-size:smaller } 41 pre.smalllisp { font-size:smaller } 42 span.sc { font-variant:small-caps } 43 span.roman { font-family:serif; font-weight:normal; } 44 span.sansserif { font-family:sans-serif; font-weight:normal; } 45--></style> 46<link rel="stylesheet" type="text/css" href="../cs.css"> 47</head> 48<body> 49<h1 class="settitle">The C Preprocessor</h1> 50<div class="contents"> 51<h2>Table of Contents</h2> 52<ul> 53<li><a name="toc_Top" href="index.html#Top">The C Preprocessor</a> 54<li><a name="toc_Overview" href="Overview.html#Overview">1 Overview</a> 55<ul> 56<li><a href="Character-sets.html#Character-sets">1.1 Character sets</a> 57<li><a href="Initial-processing.html#Initial-processing">1.2 Initial processing</a> 58<li><a href="Tokenization.html#Tokenization">1.3 Tokenization</a> 59<li><a href="The-preprocessing-language.html#The-preprocessing-language">1.4 The preprocessing language</a> 60</li></ul> 61<li><a name="toc_Header-Files" href="Header-Files.html#Header-Files">2 Header Files</a> 62<ul> 63<li><a href="Include-Syntax.html#Include-Syntax">2.1 Include Syntax</a> 64<li><a href="Include-Operation.html#Include-Operation">2.2 Include Operation</a> 65<li><a href="Search-Path.html#Search-Path">2.3 Search Path</a> 66<li><a href="Once_002dOnly-Headers.html#Once_002dOnly-Headers">2.4 Once-Only Headers</a> 67<li><a href="Alternatives-to-Wrapper-_0023ifndef.html#Alternatives-to-Wrapper-_0023ifndef">2.5 Alternatives to Wrapper #ifndef</a> 68<li><a href="Computed-Includes.html#Computed-Includes">2.6 Computed Includes</a> 69<li><a href="Wrapper-Headers.html#Wrapper-Headers">2.7 Wrapper Headers</a> 70<li><a href="System-Headers.html#System-Headers">2.8 System Headers</a> 71</li></ul> 72<li><a name="toc_Macros" href="Macros.html#Macros">3 Macros</a> 73<ul> 74<li><a href="Object_002dlike-Macros.html#Object_002dlike-Macros">3.1 Object-like Macros</a> 75<li><a href="Function_002dlike-Macros.html#Function_002dlike-Macros">3.2 Function-like Macros</a> 76<li><a href="Macro-Arguments.html#Macro-Arguments">3.3 Macro Arguments</a> 77<li><a href="Stringification.html#Stringification">3.4 Stringification</a> 78<li><a href="Concatenation.html#Concatenation">3.5 Concatenation</a> 79<li><a href="Variadic-Macros.html#Variadic-Macros">3.6 Variadic Macros</a> 80<li><a href="Predefined-Macros.html#Predefined-Macros">3.7 Predefined Macros</a> 81<ul> 82<li><a href="Standard-Predefined-Macros.html#Standard-Predefined-Macros">3.7.1 Standard Predefined Macros</a> 83<li><a href="Common-Predefined-Macros.html#Common-Predefined-Macros">3.7.2 Common Predefined Macros</a> 84<li><a href="System_002dspecific-Predefined-Macros.html#System_002dspecific-Predefined-Macros">3.7.3 System-specific Predefined Macros</a> 85<li><a href="C_002b_002b-Named-Operators.html#C_002b_002b-Named-Operators">3.7.4 C++ Named Operators</a> 86</li></ul> 87<li><a href="Undefining-and-Redefining-Macros.html#Undefining-and-Redefining-Macros">3.8 Undefining and Redefining Macros</a> 88<li><a href="Directives-Within-Macro-Arguments.html#Directives-Within-Macro-Arguments">3.9 Directives Within Macro Arguments</a> 89<li><a href="Macro-Pitfalls.html#Macro-Pitfalls">3.10 Macro Pitfalls</a> 90<ul> 91<li><a href="Misnesting.html#Misnesting">3.10.1 Misnesting</a> 92<li><a href="Operator-Precedence-Problems.html#Operator-Precedence-Problems">3.10.2 Operator Precedence Problems</a> 93<li><a href="Swallowing-the-Semicolon.html#Swallowing-the-Semicolon">3.10.3 Swallowing the Semicolon</a> 94<li><a href="Duplication-of-Side-Effects.html#Duplication-of-Side-Effects">3.10.4 Duplication of Side Effects</a> 95<li><a href="Self_002dReferential-Macros.html#Self_002dReferential-Macros">3.10.5 Self-Referential Macros</a> 96<li><a href="Argument-Prescan.html#Argument-Prescan">3.10.6 Argument Prescan</a> 97<li><a href="Newlines-in-Arguments.html#Newlines-in-Arguments">3.10.7 Newlines in Arguments</a> 98</li></ul> 99</li></ul> 100<li><a name="toc_Conditionals" href="Conditionals.html#Conditionals">4 Conditionals</a> 101<ul> 102<li><a href="Conditional-Uses.html#Conditional-Uses">4.1 Conditional Uses</a> 103<li><a href="Conditional-Syntax.html#Conditional-Syntax">4.2 Conditional Syntax</a> 104<ul> 105<li><a href="Ifdef.html#Ifdef">4.2.1 Ifdef</a> 106<li><a href="If.html#If">4.2.2 If</a> 107<li><a href="Defined.html#Defined">4.2.3 Defined</a> 108<li><a href="Else.html#Else">4.2.4 Else</a> 109<li><a href="Elif.html#Elif">4.2.5 Elif</a> 110</li></ul> 111<li><a href="Deleted-Code.html#Deleted-Code">4.3 Deleted Code</a> 112</li></ul> 113<li><a name="toc_Diagnostics" href="Diagnostics.html#Diagnostics">5 Diagnostics</a> 114<li><a name="toc_Line-Control" href="Line-Control.html#Line-Control">6 Line Control</a> 115<li><a name="toc_Pragmas" href="Pragmas.html#Pragmas">7 Pragmas</a> 116<li><a name="toc_Other-Directives" href="Other-Directives.html#Other-Directives">8 Other Directives</a> 117<li><a name="toc_Preprocessor-Output" href="Preprocessor-Output.html#Preprocessor-Output">9 Preprocessor Output</a> 118<li><a name="toc_Traditional-Mode" href="Traditional-Mode.html#Traditional-Mode">10 Traditional Mode</a> 119<ul> 120<li><a href="Traditional-lexical-analysis.html#Traditional-lexical-analysis">10.1 Traditional lexical analysis</a> 121<li><a href="Traditional-macros.html#Traditional-macros">10.2 Traditional macros</a> 122<li><a href="Traditional-miscellany.html#Traditional-miscellany">10.3 Traditional miscellany</a> 123<li><a href="Traditional-warnings.html#Traditional-warnings">10.4 Traditional warnings</a> 124</li></ul> 125<li><a name="toc_Implementation-Details" href="Implementation-Details.html#Implementation-Details">11 Implementation Details</a> 126<ul> 127<li><a href="Implementation_002ddefined-behavior.html#Implementation_002ddefined-behavior">11.1 Implementation-defined behavior</a> 128<li><a href="Implementation-limits.html#Implementation-limits">11.2 Implementation limits</a> 129<li><a href="Obsolete-Features.html#Obsolete-Features">11.3 Obsolete Features</a> 130<ul> 131<li><a href="Obsolete-Features.html#Obsolete-Features">11.3.1 Assertions</a> 132</li></ul> 133<li><a href="Differences-from-previous-versions.html#Differences-from-previous-versions">11.4 Differences from previous versions</a> 134</li></ul> 135<li><a name="toc_Invocation" href="Invocation.html#Invocation">12 Invocation</a> 136<li><a name="toc_Environment-Variables" href="Environment-Variables.html#Environment-Variables">13 Environment Variables</a> 137<li><a name="toc_GNU-Free-Documentation-License" href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a> 138<ul> 139<li><a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">ADDENDUM: How to use this License for your documents</a> 140</li></ul> 141<li><a name="toc_Index-of-Directives" href="Index-of-Directives.html#Index-of-Directives">Index of Directives</a> 142<li><a name="toc_Option-Index" href="Option-Index.html#Option-Index">Option Index</a> 143<li><a name="toc_Concept-Index" href="Concept-Index.html#Concept-Index">Concept Index</a> 144</li></ul> 145</div> 146 147 148 149<div class="node"> 150<a name="Top"></a> 151<p> 152Next: <a rel="next" accesskey="n" href="Overview.html#Overview">Overview</a>, 153Up: <a rel="up" accesskey="u" href="../index.html#dir">(dir)</a> 154<hr> 155</div> 156 157<h2 class="unnumbered">The C Preprocessor</h2> 158 159<p>The C preprocessor implements the macro language used to transform C, 160C++, and Objective-C programs before they are compiled. It can also be 161useful on its own. 162 163<ul class="menu"> 164<li><a accesskey="1" href="Overview.html#Overview">Overview</a> 165<li><a accesskey="2" href="Header-Files.html#Header-Files">Header Files</a> 166<li><a accesskey="3" href="Macros.html#Macros">Macros</a> 167<li><a accesskey="4" href="Conditionals.html#Conditionals">Conditionals</a> 168<li><a accesskey="5" href="Diagnostics.html#Diagnostics">Diagnostics</a> 169<li><a accesskey="6" href="Line-Control.html#Line-Control">Line Control</a> 170<li><a accesskey="7" href="Pragmas.html#Pragmas">Pragmas</a> 171<li><a accesskey="8" href="Other-Directives.html#Other-Directives">Other Directives</a> 172<li><a accesskey="9" href="Preprocessor-Output.html#Preprocessor-Output">Preprocessor Output</a> 173<li><a href="Traditional-Mode.html#Traditional-Mode">Traditional Mode</a> 174<li><a href="Implementation-Details.html#Implementation-Details">Implementation Details</a> 175<li><a href="Invocation.html#Invocation">Invocation</a> 176<li><a href="Environment-Variables.html#Environment-Variables">Environment Variables</a> 177<li><a href="GNU-Free-Documentation-License.html#GNU-Free-Documentation-License">GNU Free Documentation License</a> 178<li><a href="Index-of-Directives.html#Index-of-Directives">Index of Directives</a> 179<li><a href="Option-Index.html#Option-Index">Option Index</a> 180<li><a href="Concept-Index.html#Concept-Index">Concept Index</a> 181 182</li></ul> 183<p>--- The Detailed Node Listing --- 184 185<p>Overview 186 187</p> 188<ul class="menu"> 189<li><a href="Character-sets.html#Character-sets">Character sets</a> 190<li><a href="Initial-processing.html#Initial-processing">Initial processing</a> 191<li><a href="Tokenization.html#Tokenization">Tokenization</a> 192<li><a href="The-preprocessing-language.html#The-preprocessing-language">The preprocessing language</a> 193 194</li></ul> 195<p>Header Files 196 197</p> 198<ul class="menu"> 199<li><a href="Include-Syntax.html#Include-Syntax">Include Syntax</a> 200<li><a href="Include-Operation.html#Include-Operation">Include Operation</a> 201<li><a href="Search-Path.html#Search-Path">Search Path</a> 202<li><a href="Once_002dOnly-Headers.html#Once_002dOnly-Headers">Once-Only Headers</a> 203<li><a href="Alternatives-to-Wrapper-_0023ifndef.html#Alternatives-to-Wrapper-_0023ifndef">Alternatives to Wrapper #ifndef</a> 204<li><a href="Computed-Includes.html#Computed-Includes">Computed Includes</a> 205<li><a href="Wrapper-Headers.html#Wrapper-Headers">Wrapper Headers</a> 206<li><a href="System-Headers.html#System-Headers">System Headers</a> 207 208</li></ul> 209<p>Macros 210 211</p> 212<ul class="menu"> 213<li><a href="Object_002dlike-Macros.html#Object_002dlike-Macros">Object-like Macros</a> 214<li><a href="Function_002dlike-Macros.html#Function_002dlike-Macros">Function-like Macros</a> 215<li><a href="Macro-Arguments.html#Macro-Arguments">Macro Arguments</a> 216<li><a href="Stringification.html#Stringification">Stringification</a> 217<li><a href="Concatenation.html#Concatenation">Concatenation</a> 218<li><a href="Variadic-Macros.html#Variadic-Macros">Variadic Macros</a> 219<li><a href="Predefined-Macros.html#Predefined-Macros">Predefined Macros</a> 220<li><a href="Undefining-and-Redefining-Macros.html#Undefining-and-Redefining-Macros">Undefining and Redefining Macros</a> 221<li><a href="Directives-Within-Macro-Arguments.html#Directives-Within-Macro-Arguments">Directives Within Macro Arguments</a> 222<li><a href="Macro-Pitfalls.html#Macro-Pitfalls">Macro Pitfalls</a> 223 224</li></ul> 225<p>Predefined Macros 226 227</p> 228<ul class="menu"> 229<li><a href="Standard-Predefined-Macros.html#Standard-Predefined-Macros">Standard Predefined Macros</a> 230<li><a href="Common-Predefined-Macros.html#Common-Predefined-Macros">Common Predefined Macros</a> 231<li><a href="System_002dspecific-Predefined-Macros.html#System_002dspecific-Predefined-Macros">System-specific Predefined Macros</a> 232<li><a href="C_002b_002b-Named-Operators.html#C_002b_002b-Named-Operators">C++ Named Operators</a> 233 234</li></ul> 235<p>Macro Pitfalls 236 237</p> 238<ul class="menu"> 239<li><a href="Misnesting.html#Misnesting">Misnesting</a> 240<li><a href="Operator-Precedence-Problems.html#Operator-Precedence-Problems">Operator Precedence Problems</a> 241<li><a href="Swallowing-the-Semicolon.html#Swallowing-the-Semicolon">Swallowing the Semicolon</a> 242<li><a href="Duplication-of-Side-Effects.html#Duplication-of-Side-Effects">Duplication of Side Effects</a> 243<li><a href="Self_002dReferential-Macros.html#Self_002dReferential-Macros">Self-Referential Macros</a> 244<li><a href="Argument-Prescan.html#Argument-Prescan">Argument Prescan</a> 245<li><a href="Newlines-in-Arguments.html#Newlines-in-Arguments">Newlines in Arguments</a> 246 247</li></ul> 248<p>Conditionals 249 250</p> 251<ul class="menu"> 252<li><a href="Conditional-Uses.html#Conditional-Uses">Conditional Uses</a> 253<li><a href="Conditional-Syntax.html#Conditional-Syntax">Conditional Syntax</a> 254<li><a href="Deleted-Code.html#Deleted-Code">Deleted Code</a> 255 256</li></ul> 257<p>Conditional Syntax 258 259</p> 260<ul class="menu"> 261<li><a href="Ifdef.html#Ifdef">Ifdef</a> 262<li><a href="If.html#If">If</a> 263<li><a href="Defined.html#Defined">Defined</a> 264<li><a href="Else.html#Else">Else</a> 265<li><a href="Elif.html#Elif">Elif</a> 266 267</li></ul> 268<p>Implementation Details 269 270</p> 271<ul class="menu"> 272<li><a href="Implementation_002ddefined-behavior.html#Implementation_002ddefined-behavior">Implementation-defined behavior</a> 273<li><a href="Implementation-limits.html#Implementation-limits">Implementation limits</a> 274<li><a href="Obsolete-Features.html#Obsolete-Features">Obsolete Features</a> 275<li><a href="Differences-from-previous-versions.html#Differences-from-previous-versions">Differences from previous versions</a> 276 277</li></ul> 278<p>Obsolete Features 279 280</p> 281<ul class="menu"> 282<li><a href="Obsolete-Features.html#Obsolete-Features">Obsolete Features</a> 283 284 </ul> 285 286<!-- man begin COPYRIGHT --> 287 <p>Copyright © 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 2881997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2892008, 2009, 2010, 2011 290Free Software Foundation, Inc. 291 292 <p>Permission is granted to copy, distribute and/or modify this document 293under the terms of the GNU Free Documentation License, Version 1.3 or 294any later version published by the Free Software Foundation. A copy of 295the license is included in the 296<!-- man end --> 297section entitled “GNU Free Documentation License”. 298 299<!-- man begin COPYRIGHT --> 300 <p>This manual contains no Invariant Sections. The Front-Cover Texts are 301(a) (see below), and the Back-Cover Texts are (b) (see below). 302 303 <p>(a) The FSF's Front-Cover Text is: 304 305 <p>A GNU Manual 306 307 <p>(b) The FSF's Back-Cover Text is: 308 309 <p>You have freedom to copy and modify this GNU Manual, like GNU 310 software. Copies published by the Free Software Foundation raise 311 funds for GNU development. 312<!-- man end --> 313 314 </body></html> 315 316