⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 traditional-lexical-analysis.html

📁 gcc手册
💻 HTML
字号:
<html lang="en">

<head>

<title>The C Preprocessor</title>

<meta http-equiv="Content-Type" content="text/html">

<meta name="description" content="The C Preprocessor">

<meta name="generator" content="makeinfo 4.3">

<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">

<!--

Copyright &copy; 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996,

1997, 1998, 1999, 2000, 2001, 2002, 2003

Free Software Foundation, Inc.



   <p>Permission is granted to copy, distribute and/or modify this document

under the terms of the GNU Free Documentation License, Version 1.1 or

any later version published by the Free Software Foundation.  A copy of

the license is included in the

section entitled "GNU Free Documentation License".



   <p>This manual contains no Invariant Sections.  The Front-Cover Texts are

(a) (see below), and the Back-Cover Texts are (b) (see below).



   <p>(a) The FSF's Front-Cover Text is:



   <p>A GNU Manual



   <p>(b) The FSF's Back-Cover Text is:



   <p>You have freedom to copy and modify this GNU Manual, like GNU

     software.  Copies published by the Free Software Foundation raise

     funds for GNU development. 

-->

</head>

<body>

<div class="node">

<p>

Node:<a name="Traditional%20lexical%20analysis">Traditional lexical analysis</a>,

Next:<a rel="next" accesskey="n" href="Traditional-macros.html#Traditional%20macros">Traditional macros</a>,

Up:<a rel="up" accesskey="u" href="Traditional-Mode.html#Traditional%20Mode">Traditional Mode</a>

<hr><br>

</div>



<h3 class="section">Traditional lexical analysis</h3>



   <p>The traditional preprocessor does not decompose its input into tokens

the same way a standards-conforming preprocessor does.  The input is

simply treated as a stream of text with minimal internal form.



   <p>This implementation does not treat trigraphs (see <a href="trigraphs.html#trigraphs">trigraphs</a>)

specially since they were an invention of the standards committee.  It

handles arbitrarily-positioned escaped newlines properly and splices

the lines as you would expect; many traditional preprocessors did not

do this.



   <p>The form of horizontal whitespace in the input file is preserved in

the output.  In particular, hard tabs remain hard tabs.  This can be

useful if, for example, you are preprocessing a Makefile.



   <p>Traditional CPP only recognizes C-style block comments, and treats the

<code>/*</code> sequence as introducing a comment only if it lies outside

quoted text.  Quoted text is introduced by the usual single and double

quotes, and also by an initial <code>&lt;</code> in a <code>#include</code>

directive.



   <p>Traditionally, comments are completely removed and are not replaced

with a space.  Since a traditional compiler does its own tokenization

of the output of the preprocessor, this means that comments can

effectively be used as token paste operators.  However, comments

behave like separators for text handled by the preprocessor itself,

since it doesn't re-lex its input.  For example, in



<pre class="smallexample">     #if foo/**/bar

     </pre>



<p><code>foo</code> and <code>bar</code> are distinct identifiers and expanded

separately if they happen to be macros.  In other words, this

directive is equivalent to



<pre class="smallexample">     #if foo bar

     </pre>



<p>rather than



<pre class="smallexample">     #if foobar

     </pre>



   <p>Generally speaking, in traditional mode an opening quote need not have

a matching closing quote.  In particular, a macro may be defined with

replacement text that contains an unmatched quote.  Of course, if you

attempt to compile preprocessed output containing an unmatched quote

you will get a syntax error.



   <p>However, all preprocessing directives other than <code>#define</code>

require matching quotes.  For example:



<pre class="smallexample">     #define m This macro's fine and has an unmatched quote

     "/* This is not a comment.  */

     /* This is a comment.  The following #include directive

        is ill-formed.  */

     #include &lt;stdio.h

     </pre>



   <p>Just as for the ISO preprocessor, what would be a closing quote can be

escaped with a backslash to prevent the quoted text from closing.



   </body></html>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -