選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

Implementation_002ddefined-behavior.html 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1987-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation. A copy of
  7. the license is included in the
  8. section entitled "GNU Free Documentation License".
  9. This manual contains no Invariant Sections. The Front-Cover Texts are
  10. (a) (see below), and the Back-Cover Texts are (b) (see below).
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>Implementation-defined behavior (The C Preprocessor)</title>
  21. <meta name="description" content="Implementation-defined behavior (The C Preprocessor)">
  22. <meta name="keywords" content="Implementation-defined behavior (The C Preprocessor)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Index-of-Directives.html#Index-of-Directives" rel="index" title="Index of Directives">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Implementation-Details.html#Implementation-Details" rel="up" title="Implementation Details">
  30. <link href="Implementation-limits.html#Implementation-limits" rel="next" title="Implementation limits">
  31. <link href="Implementation-Details.html#Implementation-Details" rel="prev" title="Implementation Details">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="Implementation_002ddefined-behavior"></a>
  62. <div class="header">
  63. <p>
  64. 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>
  65. </div>
  66. <hr>
  67. <a name="Implementation_002ddefined-behavior-1"></a>
  68. <h3 class="section">11.1 Implementation-defined behavior</h3>
  69. <a name="index-implementation_002ddefined-behavior"></a>
  70. <p>This is how CPP behaves in all the cases which the C standard
  71. describes as <em>implementation-defined</em>. This term means that the
  72. implementation is free to do what it likes, but must document its choice
  73. and stick to it.
  74. </p>
  75. <ul>
  76. <li> The mapping of physical source file multi-byte characters to the
  77. execution character set.
  78. <p>The input character set can be specified using the
  79. <samp>-finput-charset</samp> option, while the execution character set may
  80. be controlled using the <samp>-fexec-charset</samp> and
  81. <samp>-fwide-exec-charset</samp> options.
  82. </p>
  83. </li><li> Identifier characters.
  84. <a name="Identifier-characters"></a>
  85. <p>The C and C++ standards allow identifiers to be composed of &lsquo;<samp>_</samp>&rsquo;
  86. and the alphanumeric characters. C++ also allows universal character
  87. names. C99 and later C standards permit both universal character
  88. names and implementation-defined characters. In both C and C++ modes,
  89. GCC accepts in identifiers exactly those extended characters that
  90. correspond to universal character names permitted by the chosen
  91. standard.
  92. </p>
  93. <p>GCC allows the &lsquo;<samp>$</samp>&rsquo; character in identifiers as an extension for
  94. most targets. This is true regardless of the <samp>std=</samp> switch,
  95. since this extension cannot conflict with standards-conforming
  96. programs. When preprocessing assembler, however, dollars are not
  97. identifier characters by default.
  98. </p>
  99. <p>Currently the targets that by default do not permit &lsquo;<samp>$</samp>&rsquo; are AVR,
  100. IP2K, MMIX, MIPS Irix 3, ARM aout, and PowerPC targets for the AIX
  101. operating system.
  102. </p>
  103. <p>You can override the default with <samp>-fdollars-in-identifiers</samp> or
  104. <samp>fno-dollars-in-identifiers</samp>. See <a href="Invocation.html#fdollars_002din_002didentifiers">fdollars-in-identifiers</a>.
  105. </p>
  106. </li><li> Non-empty sequences of whitespace characters.
  107. <p>In textual output, each whitespace sequence is collapsed to a single
  108. space. For aesthetic reasons, the first token on each non-directive
  109. line of output is preceded with sufficient spaces that it appears in the
  110. same column as it did in the original source file.
  111. </p>
  112. </li><li> The numeric value of character constants in preprocessor expressions.
  113. <p>The preprocessor and compiler interpret character constants in the
  114. same way; i.e. escape sequences such as &lsquo;<samp>\a</samp>&rsquo; are given the
  115. values they would have on the target machine.
  116. </p>
  117. <p>The compiler evaluates a multi-character character constant a character
  118. at a time, shifting the previous value left by the number of bits per
  119. target character, and then or-ing in the bit-pattern of the new
  120. character truncated to the width of a target character. The final
  121. bit-pattern is given type <code>int</code>, and is therefore signed,
  122. regardless of whether single characters are signed or not.
  123. If there are more
  124. characters in the constant than would fit in the target <code>int</code> the
  125. compiler issues a warning, and the excess leading characters are
  126. ignored.
  127. </p>
  128. <p>For example, <code>'ab'</code> for a target with an 8-bit <code>char</code> would be
  129. 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 -->.
  130. </p>
  131. </li><li> Source file inclusion.
  132. <p>For a discussion on how the preprocessor locates header files,
  133. <a href="Include-Operation.html#Include-Operation">Include Operation</a>.
  134. </p>
  135. </li><li> Interpretation of the filename resulting from a macro-expanded
  136. &lsquo;<samp>#include</samp>&rsquo; directive.
  137. <p>See <a href="Computed-Includes.html#Computed-Includes">Computed Includes</a>.
  138. </p>
  139. </li><li> Treatment of a &lsquo;<samp>#pragma</samp>&rsquo; directive that after macro-expansion
  140. results in a standard pragma.
  141. <p>No macro expansion occurs on any &lsquo;<samp>#pragma</samp>&rsquo; directive line, so the
  142. question does not arise.
  143. </p>
  144. <p>Note that GCC does not yet implement any of the standard
  145. pragmas.
  146. </p>
  147. </li></ul>
  148. <hr>
  149. <div class="header">
  150. <p>
  151. 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>
  152. </div>
  153. </body>
  154. </html>