Common-Predefined-Macros.html 30 KB

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