• 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>Implementation-defined behavior - 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="Implementation-Details.html#Implementation-Details" title="Implementation Details">
9<link rel="next" href="Implementation-limits.html#Implementation-limits" title="Implementation limits">
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="Implementation-defined-behavior"></a>
53<a name="Implementation_002ddefined-behavior"></a>
54<p>
55Next:&nbsp;<a rel="next" accesskey="n" href="Implementation-limits.html#Implementation-limits">Implementation limits</a>,
56Up:&nbsp;<a rel="up" accesskey="u" href="Implementation-Details.html#Implementation-Details">Implementation Details</a>
57<hr>
58</div>
59
60<h3 class="section">11.1 Implementation-defined behavior</h3>
61
62<p><a name="index-implementation_002ddefined-behavior-109"></a>
63This is how CPP behaves in all the cases which the C standard
64describes as <dfn>implementation-defined</dfn>.  This term means that the
65implementation is free to do what it likes, but must document its choice
66and stick to it. 
67<!-- FIXME: Check the C++ standard for more implementation-defined stuff. -->
68
69     <ul>
70<li>The mapping of physical source file multi-byte characters to the
71execution character set.
72
73     <p>The input character set can be specified using the
74<samp><span class="option">-finput-charset</span></samp> option, while the execution character set may
75be controlled using the <samp><span class="option">-fexec-charset</span></samp> and
76<samp><span class="option">-fwide-exec-charset</span></samp> options.
77
78     <li>Identifier characters. 
79<a name="Identifier-characters"></a>The C and C++ standards allow identifiers to be composed of &lsquo;<samp><span class="samp">_</span></samp>&rsquo;
80and the alphanumeric characters.  C++ and C99 also allow universal
81character names, and C99 further permits implementation-defined
82characters.  GCC currently only permits universal character names if
83<samp><span class="option">-fextended-identifiers</span></samp> is used, because the implementation of
84universal character names in identifiers is experimental.
85
86     <p>GCC allows the &lsquo;<samp><span class="samp">$</span></samp>&rsquo; character in identifiers as an extension for
87most targets.  This is true regardless of the <samp><span class="option">std=</span></samp> switch,
88since this extension cannot conflict with standards-conforming
89programs.  When preprocessing assembler, however, dollars are not
90identifier characters by default.
91
92     <p>Currently the targets that by default do not permit &lsquo;<samp><span class="samp">$</span></samp>&rsquo; are AVR,
93IP2K, MMIX, MIPS Irix 3, ARM aout, and PowerPC targets for the AIX
94operating system.
95
96     <p>You can override the default with <samp><span class="option">-fdollars-in-identifiers</span></samp> or
97<samp><span class="option">fno-dollars-in-identifiers</span></samp>.  See <a href="fdollars_002din_002didentifiers.html#fdollars_002din_002didentifiers">fdollars-in-identifiers</a>.
98
99     <li>Non-empty sequences of whitespace characters.
100
101     <p>In textual output, each whitespace sequence is collapsed to a single
102space.  For aesthetic reasons, the first token on each non-directive
103line of output is preceded with sufficient spaces that it appears in the
104same column as it did in the original source file.
105
106     <li>The numeric value of character constants in preprocessor expressions.
107
108     <p>The preprocessor and compiler interpret character constants in the
109same way; i.e. escape sequences such as &lsquo;<samp><span class="samp">\a</span></samp>&rsquo; are given the
110values they would have on the target machine.
111
112     <p>The compiler evaluates a multi-character character constant a character
113at a time, shifting the previous value left by the number of bits per
114target character, and then or-ing in the bit-pattern of the new
115character truncated to the width of a target character.  The final
116bit-pattern is given type <code>int</code>, and is therefore signed,
117regardless of whether single characters are signed or not (a slight
118change from versions 3.1 and earlier of GCC).  If there are more
119characters in the constant than would fit in the target <code>int</code> the
120compiler issues a warning, and the excess leading characters are
121ignored.
122
123     <p>For example, <code>'ab'</code> for a target with an 8-bit <code>char</code> would be
124interpreted as &lsquo;<samp><span class="samp">(int)&nbsp;((unsigned&nbsp;char)&nbsp;'a'&nbsp;*&nbsp;256&nbsp;+&nbsp;(unsigned&nbsp;char)&nbsp;'b')</span></samp>&rsquo;<!-- /@w -->, and <code>'\234a'</code> as &lsquo;<samp><span class="samp">(int)&nbsp;((unsigned&nbsp;char)&nbsp;'\234'&nbsp;*&nbsp;256&nbsp;+&nbsp;(unsigned&nbsp;char)&nbsp;'a')</span></samp>&rsquo;<!-- /@w -->.
125
126     <li>Source file inclusion.
127
128     <p>For a discussion on how the preprocessor locates header files,
129<a href="Include-Operation.html#Include-Operation">Include Operation</a>.
130
131     <li>Interpretation of the filename resulting from a macro-expanded
132&lsquo;<samp><span class="samp">#include</span></samp>&rsquo; directive.
133
134     <p>See <a href="Computed-Includes.html#Computed-Includes">Computed Includes</a>.
135
136     <li>Treatment of a &lsquo;<samp><span class="samp">#pragma</span></samp>&rsquo; directive that after macro-expansion
137results in a standard pragma.
138
139     <p>No macro expansion occurs on any &lsquo;<samp><span class="samp">#pragma</span></samp>&rsquo; directive line, so the
140question does not arise.
141
142     <p>Note that GCC does not yet implement any of the standard
143pragmas.
144
145   </ul>
146
147   </body></html>
148
149