diff options
Diffstat (limited to 'share/doc/cpp/Implementation_002ddefined-behavior.html')
-rw-r--r-- | share/doc/cpp/Implementation_002ddefined-behavior.html | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/share/doc/cpp/Implementation_002ddefined-behavior.html b/share/doc/cpp/Implementation_002ddefined-behavior.html new file mode 100644 index 0000000..1361349 --- /dev/null +++ b/share/doc/cpp/Implementation_002ddefined-behavior.html @@ -0,0 +1,176 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- Copyright (C) 1987-2023 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 5.1, http://www.gnu.org/software/texinfo/ --> +<head> +<title>The C Preprocessor: Implementation-defined behavior</title> + +<meta name="description" content="The C Preprocessor: Implementation-defined behavior"> +<meta name="keywords" content="The C Preprocessor: Implementation-defined behavior"> +<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="previous" title="Implementation Details"> +<style type="text/css"> +<!-- +a.summary-letter {text-decoration: none} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.indentedblock {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smallindentedblock {margin-left: 3.2em; font-size: smaller} +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.nocodebreak {white-space:nowrap} +span.nolinebreak {white-space:nowrap} +span.roman {font-family:serif; font-weight:normal} +span.sansserif {font-family:sans-serif; font-weight:normal} +ul.no-bullet {list-style: none} +--> +</style> + + +</head> + +<body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000"> +<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> [<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 ‘<samp>_</samp>’ +and the alphanumeric characters. C++ also allows universal character +names. C99 and later C standards permit both universal character +names and implementation-defined characters. In both C and C++ modes, +GCC accepts in identifiers exactly those extended characters that +correspond to universal character names permitted by the chosen +standard. +</p> +<p>GCC allows the ‘<samp>$</samp>’ 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 ‘<samp>$</samp>’ 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 ‘<samp>\a</samp>’ 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 ‘<samp>(int) ((unsigned char) 'a' * 256 + (unsigned char) 'b')</samp>’<!-- /@w -->, and <code>'\234a'</code> as ‘<samp>(int) ((unsigned char) '\234' * 256 + (unsigned char) 'a')</samp>’<!-- /@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 +‘<samp>#include</samp>’ directive. + +<p>See <a href="Computed-Includes.html#Computed-Includes">Computed Includes</a>. +</p> +</li><li> Treatment of a ‘<samp>#pragma</samp>’ directive that after macro-expansion +results in a standard pragma. + +<p>No macro expansion occurs on any ‘<samp>#pragma</samp>’ 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> [<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> |