• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2011.09/share/doc/arm-arm-none-eabi/html/cpp/
1<html lang="en">
2<head>
3<title>Traditional lexical analysis - 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="index.html#Top">
8<link rel="up" href="Traditional-Mode.html#Traditional-Mode" title="Traditional Mode">
9<link rel="next" href="Traditional-macros.html#Traditional-macros" title="Traditional macros">
10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
11<!--
12Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,
131997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
142008, 2009, 2010, 2011
15Free Software Foundation, Inc.
16
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.3 or
19any later version published by the Free Software Foundation.  A copy of
20the license is included in the
21section entitled ``GNU Free Documentation License''.
22
23This manual contains no Invariant Sections.  The Front-Cover Texts are
24(a) (see below), and the Back-Cover Texts are (b) (see below).
25
26(a) The FSF's Front-Cover Text is:
27
28     A GNU Manual
29
30(b) The FSF's Back-Cover Text is:
31
32     You have freedom to copy and modify this GNU Manual, like GNU
33     software.  Copies published by the Free Software Foundation raise
34     funds for GNU development.
35-->
36<meta http-equiv="Content-Style-Type" content="text/css">
37<style type="text/css"><!--
38  pre.display { font-family:inherit }
39  pre.format  { font-family:inherit }
40  pre.smalldisplay { font-family:inherit; font-size:smaller }
41  pre.smallformat  { font-family:inherit; font-size:smaller }
42  pre.smallexample { font-size:smaller }
43  pre.smalllisp    { font-size:smaller }
44  span.sc    { font-variant:small-caps }
45  span.roman { font-family:serif; font-weight:normal; } 
46  span.sansserif { font-family:sans-serif; font-weight:normal; } 
47--></style>
48<link rel="stylesheet" type="text/css" href="../cs.css">
49</head>
50<body>
51<div class="node">
52<a name="Traditional-lexical-analysis"></a>
53<p>
54Next:&nbsp;<a rel="next" accesskey="n" href="Traditional-macros.html#Traditional-macros">Traditional macros</a>,
55Up:&nbsp;<a rel="up" accesskey="u" href="Traditional-Mode.html#Traditional-Mode">Traditional Mode</a>
56<hr>
57</div>
58
59<h3 class="section">10.1 Traditional lexical analysis</h3>
60
61<p>The traditional preprocessor does not decompose its input into tokens
62the same way a standards-conforming preprocessor does.  The input is
63simply treated as a stream of text with minimal internal form.
64
65   <p>This implementation does not treat trigraphs (see <a href="trigraphs.html#trigraphs">trigraphs</a>)
66specially since they were an invention of the standards committee.  It
67handles arbitrarily-positioned escaped newlines properly and splices
68the lines as you would expect; many traditional preprocessors did not
69do this.
70
71   <p>The form of horizontal whitespace in the input file is preserved in
72the output.  In particular, hard tabs remain hard tabs.  This can be
73useful if, for example, you are preprocessing a Makefile.
74
75   <p>Traditional CPP only recognizes C-style block comments, and treats the
76&lsquo;<samp><span class="samp">/*</span></samp>&rsquo; sequence as introducing a comment only if it lies outside
77quoted text.  Quoted text is introduced by the usual single and double
78quotes, and also by an initial &lsquo;<samp><span class="samp">&lt;</span></samp>&rsquo; in a <code>#include</code>
79directive.
80
81   <p>Traditionally, comments are completely removed and are not replaced
82with a space.  Since a traditional compiler does its own tokenization
83of the output of the preprocessor, this means that comments can
84effectively be used as token paste operators.  However, comments
85behave like separators for text handled by the preprocessor itself,
86since it doesn't re-lex its input.  For example, in
87
88<pre class="smallexample">     #if foo/**/bar
89</pre>
90   <p class="noindent">&lsquo;<samp><span class="samp">foo</span></samp>&rsquo; and &lsquo;<samp><span class="samp">bar</span></samp>&rsquo; are distinct identifiers and expanded
91separately if they happen to be macros.  In other words, this
92directive is equivalent to
93
94<pre class="smallexample">     #if foo bar
95</pre>
96   <p class="noindent">rather than
97
98<pre class="smallexample">     #if foobar
99</pre>
100   <p>Generally speaking, in traditional mode an opening quote need not have
101a matching closing quote.  In particular, a macro may be defined with
102replacement text that contains an unmatched quote.  Of course, if you
103attempt to compile preprocessed output containing an unmatched quote
104you will get a syntax error.
105
106   <p>However, all preprocessing directives other than <code>#define</code>
107require matching quotes.  For example:
108
109<pre class="smallexample">     #define m This macro's fine and has an unmatched quote
110     "/* This is not a comment.  */
111     /* <span class="roman">This is a comment.  The following #include directive
112        is ill-formed.</span>  */
113     #include &lt;stdio.h
114</pre>
115   <p>Just as for the ISO preprocessor, what would be a closing quote can be
116escaped with a backslash to prevent the quoted text from closing.
117
118   </body></html>
119
120