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

Common-Predefined-Macros.html 30KB

3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  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>Common Predefined Macros (The C Preprocessor)</title>
  21. <meta name="description" content="Common Predefined Macros (The C Preprocessor)">
  22. <meta name="keywords" content="Common Predefined Macros (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="Predefined-Macros.html#Predefined-Macros" rel="up" title="Predefined Macros">
  30. <link href="System_002dspecific-Predefined-Macros.html#System_002dspecific-Predefined-Macros" rel="next" title="System-specific Predefined Macros">
  31. <link href="Standard-Predefined-Macros.html#Standard-Predefined-Macros" rel="prev" title="Standard Predefined Macros">
  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="Common-Predefined-Macros"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="System_002dspecific-Predefined-Macros.html#System_002dspecific-Predefined-Macros" accesskey="n" rel="next">System-specific Predefined Macros</a>, Previous: <a href="Standard-Predefined-Macros.html#Standard-Predefined-Macros" accesskey="p" rel="prev">Standard Predefined Macros</a>, Up: <a href="Predefined-Macros.html#Predefined-Macros" accesskey="u" rel="up">Predefined Macros</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="Common-Predefined-Macros-1"></a>
  68. <h4 class="subsection">3.7.2 Common Predefined Macros</h4>
  69. <a name="index-common-predefined-macros"></a>
  70. <p>The common predefined macros are GNU C extensions. They are available
  71. with the same meanings regardless of the machine or operating system on
  72. which you are using GNU C or GNU Fortran. Their names all start with
  73. double underscores.
  74. </p>
  75. <dl compact="compact">
  76. <dt><code>__COUNTER__</code></dt>
  77. <dd><p>This macro expands to sequential integral values starting from 0. In
  78. conjunction with the <code>##</code> operator, this provides a convenient means to
  79. generate unique identifiers. Care must be taken to ensure that
  80. <code>__COUNTER__</code> is not expanded prior to inclusion of precompiled headers
  81. which use it. Otherwise, the precompiled headers will not be used.
  82. </p>
  83. </dd>
  84. <dt><code>__GFORTRAN__</code></dt>
  85. <dd><p>The GNU Fortran compiler defines this.
  86. </p>
  87. </dd>
  88. <dt><code>__GNUC__</code></dt>
  89. <dt><code>__GNUC_MINOR__</code></dt>
  90. <dt><code>__GNUC_PATCHLEVEL__</code></dt>
  91. <dd><p>These macros are defined by all GNU compilers that use the C
  92. preprocessor: C, C++, Objective-C and Fortran. Their values are the major
  93. version, minor version, and patch level of the compiler, as integer
  94. constants. For example, GCC version <var>x</var>.<var>y</var>.<var>z</var>
  95. defines <code>__GNUC__</code> to <var>x</var>, <code>__GNUC_MINOR__</code> to <var>y</var>,
  96. and <code>__GNUC_PATCHLEVEL__</code> to <var>z</var>. These
  97. macros are also defined if you invoke the preprocessor directly.
  98. </p>
  99. <p>If all you need to know is whether or not your program is being compiled
  100. by GCC, or a non-GCC compiler that claims to accept the GNU C dialects,
  101. you can simply test <code>__GNUC__</code>. If you need to write code
  102. which depends on a specific version, you must be more careful. Each
  103. time the minor version is increased, the patch level is reset to zero;
  104. each time the major version is increased, the
  105. minor version and patch level are reset. If you wish to use the
  106. predefined macros directly in the conditional, you will need to write it
  107. like this:
  108. </p>
  109. <div class="smallexample">
  110. <pre class="smallexample">/* <span class="roman">Test for GCC &gt; 3.2.0</span> */
  111. #if __GNUC__ &gt; 3 || \
  112. (__GNUC__ == 3 &amp;&amp; (__GNUC_MINOR__ &gt; 2 || \
  113. (__GNUC_MINOR__ == 2 &amp;&amp; \
  114. __GNUC_PATCHLEVEL__ &gt; 0))
  115. </pre></div>
  116. <p>Another approach is to use the predefined macros to
  117. calculate a single number, then compare that against a threshold:
  118. </p>
  119. <div class="smallexample">
  120. <pre class="smallexample">#define GCC_VERSION (__GNUC__ * 10000 \
  121. + __GNUC_MINOR__ * 100 \
  122. + __GNUC_PATCHLEVEL__)
  123. &hellip;
  124. /* <span class="roman">Test for GCC &gt; 3.2.0</span> */
  125. #if GCC_VERSION &gt; 30200
  126. </pre></div>
  127. <p>Many people find this form easier to understand.
  128. </p>
  129. </dd>
  130. <dt><code>__GNUG__</code></dt>
  131. <dd><p>The GNU C++ compiler defines this. Testing it is equivalent to
  132. testing <code><span class="nolinebreak">(__GNUC__</span>&nbsp;&amp;&amp;&nbsp;<span class="nolinebreak">__cplusplus)</span><!-- /@w --></code>.
  133. </p>
  134. </dd>
  135. <dt><code>__STRICT_ANSI__</code></dt>
  136. <dd><p>GCC defines this macro if and only if the <samp>-ansi</samp> switch, or a
  137. <samp>-std</samp> switch specifying strict conformance to some version of ISO C
  138. or ISO C++, was specified when GCC was invoked. It is defined to &lsquo;<samp>1</samp>&rsquo;.
  139. This macro exists primarily to direct GNU libc&rsquo;s header files to use only
  140. definitions found in standard C.
  141. </p>
  142. </dd>
  143. <dt><code>__BASE_FILE__</code></dt>
  144. <dd><p>This macro expands to the name of the main input file, in the form
  145. of a C string constant. This is the source file that was specified
  146. on the command line of the preprocessor or C compiler.
  147. </p>
  148. </dd>
  149. <dt><code>__INCLUDE_LEVEL__</code></dt>
  150. <dd><p>This macro expands to a decimal integer constant that represents the
  151. depth of nesting in include files. The value of this macro is
  152. incremented on every &lsquo;<samp>#include</samp>&rsquo; directive and decremented at the
  153. end of every included file. It starts out at 0, its value within the
  154. base file specified on the command line.
  155. </p>
  156. </dd>
  157. <dt><code>__ELF__</code></dt>
  158. <dd><p>This macro is defined if the target uses the ELF object format.
  159. </p>
  160. </dd>
  161. <dt><code>__VERSION__</code></dt>
  162. <dd><p>This macro expands to a string constant which describes the version of
  163. the compiler in use. You should not rely on its contents having any
  164. particular form, but it can be counted on to contain at least the
  165. release number.
  166. </p>
  167. </dd>
  168. <dt><code>__OPTIMIZE__</code></dt>
  169. <dt><code>__OPTIMIZE_SIZE__</code></dt>
  170. <dt><code>__NO_INLINE__</code></dt>
  171. <dd><p>These macros describe the compilation mode. <code>__OPTIMIZE__</code> is
  172. defined in all optimizing compilations. <code>__OPTIMIZE_SIZE__</code> is
  173. defined if the compiler is optimizing for size, not speed.
  174. <code>__NO_INLINE__</code> is defined if no functions will be inlined into
  175. their callers (when not optimizing, or when inlining has been
  176. specifically disabled by <samp>-fno-inline</samp>).
  177. </p>
  178. <p>These macros cause certain GNU header files to provide optimized
  179. definitions, using macros or inline functions, of system library
  180. functions. You should not use these macros in any way unless you make
  181. sure that programs will execute with the same effect whether or not they
  182. are defined. If they are defined, their value is 1.
  183. </p>
  184. </dd>
  185. <dt><code>__GNUC_GNU_INLINE__</code></dt>
  186. <dd><p>GCC defines this macro if functions declared <code>inline</code> will be
  187. handled in GCC&rsquo;s traditional gnu90 mode. Object files will contain
  188. externally visible definitions of all functions declared <code>inline</code>
  189. without <code>extern</code> or <code>static</code>. They will not contain any
  190. definitions of any functions declared <code>extern inline</code>.
  191. </p>
  192. </dd>
  193. <dt><code>__GNUC_STDC_INLINE__</code></dt>
  194. <dd><p>GCC defines this macro if functions declared <code>inline</code> will be
  195. handled according to the ISO C99 or later standards. Object files will contain
  196. externally visible definitions of all functions declared <code>extern
  197. inline</code>. They will not contain definitions of any functions declared
  198. <code>inline</code> without <code>extern</code>.
  199. </p>
  200. <p>If this macro is defined, GCC supports the <code>gnu_inline</code> function
  201. attribute as a way to always get the gnu90 behavior.
  202. </p>
  203. </dd>
  204. <dt><code>__CHAR_UNSIGNED__</code></dt>
  205. <dd><p>GCC defines this macro if and only if the data type <code>char</code> is
  206. unsigned on the target machine. It exists to cause the standard header
  207. file <samp>limits.h</samp> to work correctly. You should not use this macro
  208. yourself; instead, refer to the standard macros defined in <samp>limits.h</samp>.
  209. </p>
  210. </dd>
  211. <dt><code>__WCHAR_UNSIGNED__</code></dt>
  212. <dd><p>Like <code>__CHAR_UNSIGNED__</code>, this macro is defined if and only if the
  213. data type <code>wchar_t</code> is unsigned and the front-end is in C++ mode.
  214. </p>
  215. </dd>
  216. <dt><code>__REGISTER_PREFIX__</code></dt>
  217. <dd><p>This macro expands to a single token (not a string constant) which is
  218. the prefix applied to CPU register names in assembly language for this
  219. target. You can use it to write assembly that is usable in multiple
  220. environments. For example, in the <code>m68k-aout</code> environment it
  221. expands to nothing, but in the <code>m68k-coff</code> environment it expands
  222. to a single &lsquo;<samp>%</samp>&rsquo;.
  223. </p>
  224. </dd>
  225. <dt><code>__USER_LABEL_PREFIX__</code></dt>
  226. <dd><p>This macro expands to a single token which is the prefix applied to
  227. user labels (symbols visible to C code) in assembly. For example, in
  228. the <code>m68k-aout</code> environment it expands to an &lsquo;<samp>_</samp>&rsquo;, but in the
  229. <code>m68k-coff</code> environment it expands to nothing.
  230. </p>
  231. <p>This macro will have the correct definition even if
  232. <samp>-f(no-)underscores</samp> is in use, but it will not be correct if
  233. target-specific options that adjust this prefix are used (e.g. the
  234. OSF/rose <samp>-mno-underscores</samp> option).
  235. </p>
  236. </dd>
  237. <dt><code>__SIZE_TYPE__</code></dt>
  238. <dt><code>__PTRDIFF_TYPE__</code></dt>
  239. <dt><code>__WCHAR_TYPE__</code></dt>
  240. <dt><code>__WINT_TYPE__</code></dt>
  241. <dt><code>__INTMAX_TYPE__</code></dt>
  242. <dt><code>__UINTMAX_TYPE__</code></dt>
  243. <dt><code>__SIG_ATOMIC_TYPE__</code></dt>
  244. <dt><code>__INT8_TYPE__</code></dt>
  245. <dt><code>__INT16_TYPE__</code></dt>
  246. <dt><code>__INT32_TYPE__</code></dt>
  247. <dt><code>__INT64_TYPE__</code></dt>
  248. <dt><code>__UINT8_TYPE__</code></dt>
  249. <dt><code>__UINT16_TYPE__</code></dt>
  250. <dt><code>__UINT32_TYPE__</code></dt>
  251. <dt><code>__UINT64_TYPE__</code></dt>
  252. <dt><code>__INT_LEAST8_TYPE__</code></dt>
  253. <dt><code>__INT_LEAST16_TYPE__</code></dt>
  254. <dt><code>__INT_LEAST32_TYPE__</code></dt>
  255. <dt><code>__INT_LEAST64_TYPE__</code></dt>
  256. <dt><code>__UINT_LEAST8_TYPE__</code></dt>
  257. <dt><code>__UINT_LEAST16_TYPE__</code></dt>
  258. <dt><code>__UINT_LEAST32_TYPE__</code></dt>
  259. <dt><code>__UINT_LEAST64_TYPE__</code></dt>
  260. <dt><code>__INT_FAST8_TYPE__</code></dt>
  261. <dt><code>__INT_FAST16_TYPE__</code></dt>
  262. <dt><code>__INT_FAST32_TYPE__</code></dt>
  263. <dt><code>__INT_FAST64_TYPE__</code></dt>
  264. <dt><code>__UINT_FAST8_TYPE__</code></dt>
  265. <dt><code>__UINT_FAST16_TYPE__</code></dt>
  266. <dt><code>__UINT_FAST32_TYPE__</code></dt>
  267. <dt><code>__UINT_FAST64_TYPE__</code></dt>
  268. <dt><code>__INTPTR_TYPE__</code></dt>
  269. <dt><code>__UINTPTR_TYPE__</code></dt>
  270. <dd><p>These macros are defined to the correct underlying types for the
  271. <code>size_t</code>, <code>ptrdiff_t</code>, <code>wchar_t</code>, <code>wint_t</code>,
  272. <code>intmax_t</code>, <code>uintmax_t</code>, <code>sig_atomic_t</code>, <code>int8_t</code>,
  273. <code>int16_t</code>, <code>int32_t</code>, <code>int64_t</code>, <code>uint8_t</code>,
  274. <code>uint16_t</code>, <code>uint32_t</code>, <code>uint64_t</code>,
  275. <code>int_least8_t</code>, <code>int_least16_t</code>, <code>int_least32_t</code>,
  276. <code>int_least64_t</code>, <code>uint_least8_t</code>, <code>uint_least16_t</code>,
  277. <code>uint_least32_t</code>, <code>uint_least64_t</code>, <code>int_fast8_t</code>,
  278. <code>int_fast16_t</code>, <code>int_fast32_t</code>, <code>int_fast64_t</code>,
  279. <code>uint_fast8_t</code>, <code>uint_fast16_t</code>, <code>uint_fast32_t</code>,
  280. <code>uint_fast64_t</code>, <code>intptr_t</code>, and <code>uintptr_t</code> typedefs,
  281. respectively. They exist to make the standard header files
  282. <samp>stddef.h</samp>, <samp>stdint.h</samp>, and <samp>wchar.h</samp> work correctly.
  283. You should not use these macros directly; instead, include the
  284. appropriate headers and use the typedefs. Some of these macros may
  285. not be defined on particular systems if GCC does not provide a
  286. <samp>stdint.h</samp> header on those systems.
  287. </p>
  288. </dd>
  289. <dt><code>__CHAR_BIT__</code></dt>
  290. <dd><p>Defined to the number of bits used in the representation of the
  291. <code>char</code> data type. It exists to make the standard header given
  292. numerical limits work correctly. You should not use
  293. this macro directly; instead, include the appropriate headers.
  294. </p>
  295. </dd>
  296. <dt><code>__SCHAR_MAX__</code></dt>
  297. <dt><code>__WCHAR_MAX__</code></dt>
  298. <dt><code>__SHRT_MAX__</code></dt>
  299. <dt><code>__INT_MAX__</code></dt>
  300. <dt><code>__LONG_MAX__</code></dt>
  301. <dt><code>__LONG_LONG_MAX__</code></dt>
  302. <dt><code>__WINT_MAX__</code></dt>
  303. <dt><code>__SIZE_MAX__</code></dt>
  304. <dt><code>__PTRDIFF_MAX__</code></dt>
  305. <dt><code>__INTMAX_MAX__</code></dt>
  306. <dt><code>__UINTMAX_MAX__</code></dt>
  307. <dt><code>__SIG_ATOMIC_MAX__</code></dt>
  308. <dt><code>__INT8_MAX__</code></dt>
  309. <dt><code>__INT16_MAX__</code></dt>
  310. <dt><code>__INT32_MAX__</code></dt>
  311. <dt><code>__INT64_MAX__</code></dt>
  312. <dt><code>__UINT8_MAX__</code></dt>
  313. <dt><code>__UINT16_MAX__</code></dt>
  314. <dt><code>__UINT32_MAX__</code></dt>
  315. <dt><code>__UINT64_MAX__</code></dt>
  316. <dt><code>__INT_LEAST8_MAX__</code></dt>
  317. <dt><code>__INT_LEAST16_MAX__</code></dt>
  318. <dt><code>__INT_LEAST32_MAX__</code></dt>
  319. <dt><code>__INT_LEAST64_MAX__</code></dt>
  320. <dt><code>__UINT_LEAST8_MAX__</code></dt>
  321. <dt><code>__UINT_LEAST16_MAX__</code></dt>
  322. <dt><code>__UINT_LEAST32_MAX__</code></dt>
  323. <dt><code>__UINT_LEAST64_MAX__</code></dt>
  324. <dt><code>__INT_FAST8_MAX__</code></dt>
  325. <dt><code>__INT_FAST16_MAX__</code></dt>
  326. <dt><code>__INT_FAST32_MAX__</code></dt>
  327. <dt><code>__INT_FAST64_MAX__</code></dt>
  328. <dt><code>__UINT_FAST8_MAX__</code></dt>
  329. <dt><code>__UINT_FAST16_MAX__</code></dt>
  330. <dt><code>__UINT_FAST32_MAX__</code></dt>
  331. <dt><code>__UINT_FAST64_MAX__</code></dt>
  332. <dt><code>__INTPTR_MAX__</code></dt>
  333. <dt><code>__UINTPTR_MAX__</code></dt>
  334. <dt><code>__WCHAR_MIN__</code></dt>
  335. <dt><code>__WINT_MIN__</code></dt>
  336. <dt><code>__SIG_ATOMIC_MIN__</code></dt>
  337. <dd><p>Defined to the maximum value of the <code>signed char</code>, <code>wchar_t</code>,
  338. <code>signed short</code>,
  339. <code>signed int</code>, <code>signed long</code>, <code>signed long long</code>,
  340. <code>wint_t</code>, <code>size_t</code>, <code>ptrdiff_t</code>,
  341. <code>intmax_t</code>, <code>uintmax_t</code>, <code>sig_atomic_t</code>, <code>int8_t</code>,
  342. <code>int16_t</code>, <code>int32_t</code>, <code>int64_t</code>, <code>uint8_t</code>,
  343. <code>uint16_t</code>, <code>uint32_t</code>, <code>uint64_t</code>,
  344. <code>int_least8_t</code>, <code>int_least16_t</code>, <code>int_least32_t</code>,
  345. <code>int_least64_t</code>, <code>uint_least8_t</code>, <code>uint_least16_t</code>,
  346. <code>uint_least32_t</code>, <code>uint_least64_t</code>, <code>int_fast8_t</code>,
  347. <code>int_fast16_t</code>, <code>int_fast32_t</code>, <code>int_fast64_t</code>,
  348. <code>uint_fast8_t</code>, <code>uint_fast16_t</code>, <code>uint_fast32_t</code>,
  349. <code>uint_fast64_t</code>, <code>intptr_t</code>, and <code>uintptr_t</code> types and
  350. to the minimum value of the <code>wchar_t</code>, <code>wint_t</code>, and
  351. <code>sig_atomic_t</code> types respectively. They exist to make the
  352. standard header given numerical limits work correctly. You should not
  353. use these macros directly; instead, include the appropriate headers.
  354. Some of these macros may not be defined on particular systems if GCC
  355. does not provide a <samp>stdint.h</samp> header on those systems.
  356. </p>
  357. </dd>
  358. <dt><code>__INT8_C</code></dt>
  359. <dt><code>__INT16_C</code></dt>
  360. <dt><code>__INT32_C</code></dt>
  361. <dt><code>__INT64_C</code></dt>
  362. <dt><code>__UINT8_C</code></dt>
  363. <dt><code>__UINT16_C</code></dt>
  364. <dt><code>__UINT32_C</code></dt>
  365. <dt><code>__UINT64_C</code></dt>
  366. <dt><code>__INTMAX_C</code></dt>
  367. <dt><code>__UINTMAX_C</code></dt>
  368. <dd><p>Defined to implementations of the standard <samp>stdint.h</samp> macros with
  369. the same names without the leading <code>__</code>. They exist the make the
  370. implementation of that header work correctly. You should not use
  371. these macros directly; instead, include the appropriate headers. Some
  372. of these macros may not be defined on particular systems if GCC does
  373. not provide a <samp>stdint.h</samp> header on those systems.
  374. </p>
  375. </dd>
  376. <dt><code>__SCHAR_WIDTH__</code></dt>
  377. <dt><code>__SHRT_WIDTH__</code></dt>
  378. <dt><code>__INT_WIDTH__</code></dt>
  379. <dt><code>__LONG_WIDTH__</code></dt>
  380. <dt><code>__LONG_LONG_WIDTH__</code></dt>
  381. <dt><code>__PTRDIFF_WIDTH__</code></dt>
  382. <dt><code>__SIG_ATOMIC_WIDTH__</code></dt>
  383. <dt><code>__SIZE_WIDTH__</code></dt>
  384. <dt><code>__WCHAR_WIDTH__</code></dt>
  385. <dt><code>__WINT_WIDTH__</code></dt>
  386. <dt><code>__INT_LEAST8_WIDTH__</code></dt>
  387. <dt><code>__INT_LEAST16_WIDTH__</code></dt>
  388. <dt><code>__INT_LEAST32_WIDTH__</code></dt>
  389. <dt><code>__INT_LEAST64_WIDTH__</code></dt>
  390. <dt><code>__INT_FAST8_WIDTH__</code></dt>
  391. <dt><code>__INT_FAST16_WIDTH__</code></dt>
  392. <dt><code>__INT_FAST32_WIDTH__</code></dt>
  393. <dt><code>__INT_FAST64_WIDTH__</code></dt>
  394. <dt><code>__INTPTR_WIDTH__</code></dt>
  395. <dt><code>__INTMAX_WIDTH__</code></dt>
  396. <dd><p>Defined to the bit widths of the corresponding types. They exist to
  397. make the implementations of <samp>limits.h</samp> and <samp>stdint.h</samp> behave
  398. correctly. You should not use these macros directly; instead, include
  399. the appropriate headers. Some of these macros may not be defined on
  400. particular systems if GCC does not provide a <samp>stdint.h</samp> header on
  401. those systems.
  402. </p>
  403. </dd>
  404. <dt><code>__SIZEOF_INT__</code></dt>
  405. <dt><code>__SIZEOF_LONG__</code></dt>
  406. <dt><code>__SIZEOF_LONG_LONG__</code></dt>
  407. <dt><code>__SIZEOF_SHORT__</code></dt>
  408. <dt><code>__SIZEOF_POINTER__</code></dt>
  409. <dt><code>__SIZEOF_FLOAT__</code></dt>
  410. <dt><code>__SIZEOF_DOUBLE__</code></dt>
  411. <dt><code>__SIZEOF_LONG_DOUBLE__</code></dt>
  412. <dt><code>__SIZEOF_SIZE_T__</code></dt>
  413. <dt><code>__SIZEOF_WCHAR_T__</code></dt>
  414. <dt><code>__SIZEOF_WINT_T__</code></dt>
  415. <dt><code>__SIZEOF_PTRDIFF_T__</code></dt>
  416. <dd><p>Defined to the number of bytes of the C standard data types: <code>int</code>,
  417. <code>long</code>, <code>long long</code>, <code>short</code>, <code>void *</code>, <code>float</code>,
  418. <code>double</code>, <code>long double</code>, <code>size_t</code>, <code>wchar_t</code>, <code>wint_t</code>
  419. and <code>ptrdiff_t</code>.
  420. </p>
  421. </dd>
  422. <dt><code>__BYTE_ORDER__</code></dt>
  423. <dt><code>__ORDER_LITTLE_ENDIAN__</code></dt>
  424. <dt><code>__ORDER_BIG_ENDIAN__</code></dt>
  425. <dt><code>__ORDER_PDP_ENDIAN__</code></dt>
  426. <dd><p><code>__BYTE_ORDER__</code> is defined to one of the values
  427. <code>__ORDER_LITTLE_ENDIAN__</code>, <code>__ORDER_BIG_ENDIAN__</code>, or
  428. <code>__ORDER_PDP_ENDIAN__</code> to reflect the layout of multi-byte and
  429. multi-word quantities in memory. If <code>__BYTE_ORDER__</code> is equal to
  430. <code>__ORDER_LITTLE_ENDIAN__</code> or <code>__ORDER_BIG_ENDIAN__</code>, then
  431. multi-byte and multi-word quantities are laid out identically: the
  432. byte (word) at the lowest address is the least significant or most
  433. significant byte (word) of the quantity, respectively. If
  434. <code>__BYTE_ORDER__</code> is equal to <code>__ORDER_PDP_ENDIAN__</code>, then
  435. bytes in 16-bit words are laid out in a little-endian fashion, whereas
  436. the 16-bit subwords of a 32-bit quantity are laid out in big-endian
  437. fashion.
  438. </p>
  439. <p>You should use these macros for testing like this:
  440. </p>
  441. <div class="smallexample">
  442. <pre class="smallexample">/* <span class="roman">Test for a little-endian machine</span> */
  443. #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
  444. </pre></div>
  445. </dd>
  446. <dt><code>__FLOAT_WORD_ORDER__</code></dt>
  447. <dd><p><code>__FLOAT_WORD_ORDER__</code> is defined to one of the values
  448. <code>__ORDER_LITTLE_ENDIAN__</code> or <code>__ORDER_BIG_ENDIAN__</code> to reflect
  449. the layout of the words of multi-word floating-point quantities.
  450. </p>
  451. </dd>
  452. <dt><code>__DEPRECATED</code></dt>
  453. <dd><p>This macro is defined, with value 1, when compiling a C++ source file
  454. with warnings about deprecated constructs enabled. These warnings are
  455. enabled by default, but can be disabled with <samp>-Wno-deprecated</samp>.
  456. </p>
  457. </dd>
  458. <dt><code>__EXCEPTIONS</code></dt>
  459. <dd><p>This macro is defined, with value 1, when compiling a C++ source file
  460. with exceptions enabled. If <samp>-fno-exceptions</samp> is used when
  461. compiling the file, then this macro is not defined.
  462. </p>
  463. </dd>
  464. <dt><code>__GXX_RTTI</code></dt>
  465. <dd><p>This macro is defined, with value 1, when compiling a C++ source file
  466. with runtime type identification enabled. If <samp>-fno-rtti</samp> is
  467. used when compiling the file, then this macro is not defined.
  468. </p>
  469. </dd>
  470. <dt><code>__USING_SJLJ_EXCEPTIONS__</code></dt>
  471. <dd><p>This macro is defined, with value 1, if the compiler uses the old
  472. mechanism based on <code>setjmp</code> and <code>longjmp</code> for exception
  473. handling.
  474. </p>
  475. </dd>
  476. <dt><code>__GXX_EXPERIMENTAL_CXX0X__</code></dt>
  477. <dd><p>This macro is defined when compiling a C++ source file with the option
  478. <samp>-std=c++0x</samp> or <samp>-std=gnu++0x</samp>. It indicates that some
  479. features likely to be included in C++0x are available. Note that these
  480. features are experimental, and may change or be removed in future
  481. versions of GCC.
  482. </p>
  483. </dd>
  484. <dt><code>__GXX_WEAK__</code></dt>
  485. <dd><p>This macro is defined when compiling a C++ source file. It has the
  486. value 1 if the compiler will use weak symbols, COMDAT sections, or
  487. other similar techniques to collapse symbols with &ldquo;vague linkage&rdquo;
  488. that are defined in multiple translation units. If the compiler will
  489. not collapse such symbols, this macro is defined with value 0. In
  490. general, user code should not need to make use of this macro; the
  491. purpose of this macro is to ease implementation of the C++ runtime
  492. library provided with G++.
  493. </p>
  494. </dd>
  495. <dt><code>__NEXT_RUNTIME__</code></dt>
  496. <dd><p>This macro is defined, with value 1, if (and only if) the NeXT runtime
  497. (as in <samp>-fnext-runtime</samp>) is in use for Objective-C. If the GNU
  498. runtime is used, this macro is not defined, so that you can use this
  499. macro to determine which runtime (NeXT or GNU) is being used.
  500. </p>
  501. </dd>
  502. <dt><code>__LP64__</code></dt>
  503. <dt><code>_LP64</code></dt>
  504. <dd><p>These macros are defined, with value 1, if (and only if) the compilation
  505. is for a target where <code>long int</code> and pointer both use 64-bits and
  506. <code>int</code> uses 32-bit.
  507. </p>
  508. </dd>
  509. <dt><code>__SSP__</code></dt>
  510. <dd><p>This macro is defined, with value 1, when <samp>-fstack-protector</samp> is in
  511. use.
  512. </p>
  513. </dd>
  514. <dt><code>__SSP_ALL__</code></dt>
  515. <dd><p>This macro is defined, with value 2, when <samp>-fstack-protector-all</samp> is
  516. in use.
  517. </p>
  518. </dd>
  519. <dt><code>__SSP_STRONG__</code></dt>
  520. <dd><p>This macro is defined, with value 3, when <samp>-fstack-protector-strong</samp> is
  521. in use.
  522. </p>
  523. </dd>
  524. <dt><code>__SSP_EXPLICIT__</code></dt>
  525. <dd><p>This macro is defined, with value 4, when <samp>-fstack-protector-explicit</samp> is
  526. in use.
  527. </p>
  528. </dd>
  529. <dt><code>__SANITIZE_ADDRESS__</code></dt>
  530. <dd><p>This macro is defined, with value 1, when <samp>-fsanitize=address</samp>
  531. or <samp>-fsanitize=kernel-address</samp> are in use.
  532. </p>
  533. </dd>
  534. <dt><code>__SANITIZE_THREAD__</code></dt>
  535. <dd><p>This macro is defined, with value 1, when <samp>-fsanitize=thread</samp> is in use.
  536. </p>
  537. </dd>
  538. <dt><code>__TIMESTAMP__</code></dt>
  539. <dd><p>This macro expands to a string constant that describes the date and time
  540. of the last modification of the current source file. The string constant
  541. contains abbreviated day of the week, month, day of the month, time in
  542. hh:mm:ss form, year and looks like <code>&quot;Sun&nbsp;Sep&nbsp;16&nbsp;01:03:52&nbsp;1973&quot;<!-- /@w --></code>.
  543. If the day of the month is less than 10, it is padded with a space on the left.
  544. </p>
  545. <p>If GCC cannot determine the current date, it will emit a warning message
  546. (once per compilation) and <code>__TIMESTAMP__</code> will expand to
  547. <code>&quot;???&nbsp;???&nbsp;??&nbsp;??:??:??&nbsp;????&quot;<!-- /@w --></code>.
  548. </p>
  549. </dd>
  550. <dt><code>__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1</code></dt>
  551. <dt><code>__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2</code></dt>
  552. <dt><code>__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4</code></dt>
  553. <dt><code>__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8</code></dt>
  554. <dt><code>__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16</code></dt>
  555. <dd><p>These macros are defined when the target processor supports atomic compare
  556. and swap operations on operands 1, 2, 4, 8 or 16 bytes in length, respectively.
  557. </p>
  558. </dd>
  559. <dt><code>__HAVE_SPECULATION_SAFE_VALUE</code></dt>
  560. <dd><p>This macro is defined with the value 1 to show that this version of GCC
  561. supports <code>__builtin_speculation_safe_value</code>.
  562. </p>
  563. </dd>
  564. <dt><code>__GCC_HAVE_DWARF2_CFI_ASM</code></dt>
  565. <dd><p>This macro is defined when the compiler is emitting DWARF CFI directives
  566. to the assembler. When this is defined, it is possible to emit those same
  567. directives in inline assembly.
  568. </p>
  569. </dd>
  570. <dt><code>__FP_FAST_FMA</code></dt>
  571. <dt><code>__FP_FAST_FMAF</code></dt>
  572. <dt><code>__FP_FAST_FMAL</code></dt>
  573. <dd><p>These macros are defined with value 1 if the backend supports the
  574. <code>fma</code>, <code>fmaf</code>, and <code>fmal</code> builtin functions, so that
  575. the include file <samp>math.h</samp> can define the macros
  576. <code>FP_FAST_FMA</code>, <code>FP_FAST_FMAF</code>, and <code>FP_FAST_FMAL</code>
  577. for compatibility with the 1999 C standard.
  578. </p>
  579. </dd>
  580. <dt><code>__FP_FAST_FMAF16</code></dt>
  581. <dt><code>__FP_FAST_FMAF32</code></dt>
  582. <dt><code>__FP_FAST_FMAF64</code></dt>
  583. <dt><code>__FP_FAST_FMAF128</code></dt>
  584. <dt><code>__FP_FAST_FMAF32X</code></dt>
  585. <dt><code>__FP_FAST_FMAF64X</code></dt>
  586. <dt><code>__FP_FAST_FMAF128X</code></dt>
  587. <dd><p>These macros are defined with the value 1 if the backend supports the
  588. <code>fma</code> functions using the additional <code>_Float<var>n</var></code> and
  589. <code>_Float<var>n</var>x</code> types that are defined in ISO/IEC TS
  590. 18661-3:2015. The include file <samp>math.h</samp> can define the
  591. <code>FP_FAST_FMAF<var>n</var></code> and <code>FP_FAST_FMAF<var>n</var>x</code> macros if
  592. the user defined <code>__STDC_WANT_IEC_60559_TYPES_EXT__</code> before
  593. including <samp>math.h</samp>.
  594. </p>
  595. </dd>
  596. <dt><code>__GCC_IEC_559</code></dt>
  597. <dd><p>This macro is defined to indicate the intended level of support for
  598. IEEE 754 (IEC 60559) floating-point arithmetic. It expands to a
  599. nonnegative integer value. If 0, it indicates that the combination of
  600. the compiler configuration and the command-line options is not
  601. intended to support IEEE 754 arithmetic for <code>float</code> and
  602. <code>double</code> as defined in C99 and C11 Annex F (for example, that the
  603. standard rounding modes and exceptions are not supported, or that
  604. optimizations are enabled that conflict with IEEE 754 semantics). If
  605. 1, it indicates that IEEE 754 arithmetic is intended to be supported;
  606. this does not mean that all relevant language features are supported
  607. by GCC. If 2 or more, it additionally indicates support for IEEE
  608. 754-2008 (in particular, that the binary encodings for quiet and
  609. signaling NaNs are as specified in IEEE 754-2008).
  610. </p>
  611. <p>This macro does not indicate the default state of command-line options
  612. that control optimizations that C99 and C11 permit to be controlled by
  613. standard pragmas, where those standards do not require a particular
  614. default state. It does not indicate whether optimizations respect
  615. signaling NaN semantics (the macro for that is
  616. <code>__SUPPORT_SNAN__</code>). It does not indicate support for decimal
  617. floating point or the IEEE 754 binary16 and binary128 types.
  618. </p>
  619. </dd>
  620. <dt><code>__GCC_IEC_559_COMPLEX</code></dt>
  621. <dd><p>This macro is defined to indicate the intended level of support for
  622. IEEE 754 (IEC 60559) floating-point arithmetic for complex numbers, as
  623. defined in C99 and C11 Annex G. It expands to a nonnegative integer
  624. value. If 0, it indicates that the combination of the compiler
  625. configuration and the command-line options is not intended to support
  626. Annex G requirements (for example, because <samp>-fcx-limited-range</samp>
  627. was used). If 1 or more, it indicates that it is intended to support
  628. those requirements; this does not mean that all relevant language
  629. features are supported by GCC.
  630. </p>
  631. </dd>
  632. <dt><code>__NO_MATH_ERRNO__</code></dt>
  633. <dd><p>This macro is defined if <samp>-fno-math-errno</samp> is used, or enabled
  634. by another option such as <samp>-ffast-math</samp> or by default.
  635. </p></dd>
  636. </dl>
  637. <hr>
  638. <div class="header">
  639. <p>
  640. Next: <a href="System_002dspecific-Predefined-Macros.html#System_002dspecific-Predefined-Macros" accesskey="n" rel="next">System-specific Predefined Macros</a>, Previous: <a href="Standard-Predefined-Macros.html#Standard-Predefined-Macros" accesskey="p" rel="prev">Standard Predefined Macros</a>, Up: <a href="Predefined-Macros.html#Predefined-Macros" accesskey="u" rel="up">Predefined Macros</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>
  641. </div>
  642. </body>
  643. </html>