You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

173 lines
7.9 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 1987-2018 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 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".
This manual contains no Invariant Sections. The Front-Cover Texts are
(a) (see below), and the Back-Cover Texts are (b) (see below).
(a) The FSF's Front-Cover Text is:
A GNU Manual
(b) The FSF's Back-Cover Text is:
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. -->
<!-- Created by GNU Texinfo 6.4, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Implementation-defined behavior (The C Preprocessor)</title>
<meta name="description" content="Implementation-defined behavior (The C Preprocessor)">
<meta name="keywords" content="Implementation-defined behavior (The C Preprocessor)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index-of-Directives.html#Index-of-Directives" rel="index" title="Index of Directives">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Implementation-Details.html#Implementation-Details" rel="up" title="Implementation Details">
<link href="Implementation-limits.html#Implementation-limits" rel="next" title="Implementation limits">
<link href="Implementation-Details.html#Implementation-Details" rel="prev" title="Implementation Details">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Implementation_002ddefined-behavior"></a>
<div class="header">
<p>
Next: <a href="Implementation-limits.html#Implementation-limits" accesskey="n" rel="next">Implementation limits</a>, Up: <a href="Implementation-Details.html#Implementation-Details" accesskey="u" rel="up">Implementation Details</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html#Index-of-Directives" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<a name="Implementation_002ddefined-behavior-1"></a>
<h3 class="section">11.1 Implementation-defined behavior</h3>
<a name="index-implementation_002ddefined-behavior"></a>
<p>This is how CPP behaves in all the cases which the C standard
describes as <em>implementation-defined</em>. This term means that the
implementation is free to do what it likes, but must document its choice
and stick to it.
</p>
<ul>
<li> The mapping of physical source file multi-byte characters to the
execution character set.
<p>The input character set can be specified using the
<samp>-finput-charset</samp> option, while the execution character set may
be controlled using the <samp>-fexec-charset</samp> and
<samp>-fwide-exec-charset</samp> options.
</p>
</li><li> Identifier characters.
<a name="Identifier-characters"></a>
<p>The C and C++ standards allow identifiers to be composed of &lsquo;<samp>_</samp>&rsquo;
and the alphanumeric characters. C++ also allows universal character
names. C99 and later C standards permit both universal character
names and implementation-defined characters.
</p>
<p>GCC allows the &lsquo;<samp>$</samp>&rsquo; character in identifiers as an extension for
most targets. This is true regardless of the <samp>std=</samp> switch,
since this extension cannot conflict with standards-conforming
programs. When preprocessing assembler, however, dollars are not
identifier characters by default.
</p>
<p>Currently the targets that by default do not permit &lsquo;<samp>$</samp>&rsquo; are AVR,
IP2K, MMIX, MIPS Irix 3, ARM aout, and PowerPC targets for the AIX
operating system.
</p>
<p>You can override the default with <samp>-fdollars-in-identifiers</samp> or
<samp>fno-dollars-in-identifiers</samp>. See <a href="Invocation.html#fdollars_002din_002didentifiers">fdollars-in-identifiers</a>.
</p>
</li><li> Non-empty sequences of whitespace characters.
<p>In textual output, each whitespace sequence is collapsed to a single
space. For aesthetic reasons, the first token on each non-directive
line of output is preceded with sufficient spaces that it appears in the
same column as it did in the original source file.
</p>
</li><li> The numeric value of character constants in preprocessor expressions.
<p>The preprocessor and compiler interpret character constants in the
same way; i.e. escape sequences such as &lsquo;<samp>\a</samp>&rsquo; are given the
values they would have on the target machine.
</p>
<p>The compiler evaluates a multi-character character constant a character
at a time, shifting the previous value left by the number of bits per
target character, and then or-ing in the bit-pattern of the new
character truncated to the width of a target character. The final
bit-pattern is given type <code>int</code>, and is therefore signed,
regardless of whether single characters are signed or not.
If there are more
characters in the constant than would fit in the target <code>int</code> the
compiler issues a warning, and the excess leading characters are
ignored.
</p>
<p>For example, <code>'ab'</code> for a target with an 8-bit <code>char</code> would be
interpreted as &lsquo;<samp>(int)&nbsp;((unsigned&nbsp;char)&nbsp;'a'&nbsp;*&nbsp;256&nbsp;+&nbsp;(unsigned&nbsp;char)&nbsp;'b')</samp>&rsquo;<!-- /@w -->, and <code>'\234a'</code> as &lsquo;<samp>(int)&nbsp;((unsigned&nbsp;char)&nbsp;'\234'&nbsp;*&nbsp;256&nbsp;+&nbsp;(unsigned&nbsp;char)&nbsp;'a')</samp>&rsquo;<!-- /@w -->.
</p>
</li><li> Source file inclusion.
<p>For a discussion on how the preprocessor locates header files,
<a href="Include-Operation.html#Include-Operation">Include Operation</a>.
</p>
</li><li> Interpretation of the filename resulting from a macro-expanded
&lsquo;<samp>#include</samp>&rsquo; directive.
<p>See <a href="Computed-Includes.html#Computed-Includes">Computed Includes</a>.
</p>
</li><li> Treatment of a &lsquo;<samp>#pragma</samp>&rsquo; directive that after macro-expansion
results in a standard pragma.
<p>No macro expansion occurs on any &lsquo;<samp>#pragma</samp>&rsquo; directive line, so the
question does not arise.
</p>
<p>Note that GCC does not yet implement any of the standard
pragmas.
</p>
</li></ul>
<hr>
<div class="header">
<p>
Next: <a href="Implementation-limits.html#Implementation-limits" accesskey="n" rel="next">Implementation limits</a>, Up: <a href="Implementation-Details.html#Implementation-Details" accesskey="u" rel="up">Implementation Details</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html#Index-of-Directives" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>