Common-Predefined-Macros.html 32 KB

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