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.

175 lines
7.5KB

  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>Obsolete Features (The C Preprocessor)</title>
  21. <meta name="description" content="Obsolete Features (The C Preprocessor)">
  22. <meta name="keywords" content="Obsolete Features (The C Preprocessor)">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Index-of-Directives.html#Index-of-Directives" rel="index" title="Index of Directives">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Implementation-Details.html#Implementation-Details" rel="up" title="Implementation Details">
  30. <link href="Invocation.html#Invocation" rel="next" title="Invocation">
  31. <link href="Implementation-limits.html#Implementation-limits" rel="prev" title="Implementation limits">
  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="Obsolete-Features"></a>
  62. <div class="header">
  63. <p>
  64. Previous: <a href="Implementation-limits.html#Implementation-limits" accesskey="p" rel="prev">Implementation limits</a>, Up: <a href="Implementation-Details.html#Implementation-Details" accesskey="u" rel="up">Implementation Details</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html#Index-of-Directives" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="Obsolete-Features-1"></a>
  68. <h3 class="section">11.3 Obsolete Features</h3>
  69. <p>CPP has some features which are present mainly for compatibility with
  70. older programs. We discourage their use in new code. In some cases,
  71. we plan to remove the feature in a future version of GCC.
  72. </p>
  73. <a name="Assertions"></a>
  74. <h4 class="subsection">11.3.1 Assertions</h4>
  75. <a name="index-assertions"></a>
  76. <p><em>Assertions</em> are a deprecated alternative to macros in writing
  77. conditionals to test what sort of computer or system the compiled
  78. program will run on. Assertions are usually predefined, but you can
  79. define them with preprocessing directives or command-line options.
  80. </p>
  81. <p>Assertions were intended to provide a more systematic way to describe
  82. the compiler&rsquo;s target system and we added them for compatibility with
  83. existing compilers. In practice they are just as unpredictable as the
  84. system-specific predefined macros. In addition, they are not part of
  85. any standard, and only a few compilers support them.
  86. Therefore, the use of assertions is <strong>less</strong> portable than the use
  87. of system-specific predefined macros. We recommend you do not use them at
  88. all.
  89. </p>
  90. <a name="index-predicates"></a>
  91. <p>An assertion looks like this:
  92. </p>
  93. <div class="smallexample">
  94. <pre class="smallexample">#<var>predicate</var> (<var>answer</var>)
  95. </pre></div>
  96. <p><var>predicate</var> must be a single identifier. <var>answer</var> can be any
  97. sequence of tokens; all characters are significant except for leading
  98. and trailing whitespace, and differences in internal whitespace
  99. sequences are ignored. (This is similar to the rules governing macro
  100. redefinition.) Thus, <code>(x + y)</code> is different from <code>(x+y)</code> but
  101. equivalent to <code>(&nbsp;x&nbsp;+&nbsp;y&nbsp;)<!-- /@w --></code>. Parentheses do not nest inside an
  102. answer.
  103. </p>
  104. <a name="index-testing-predicates"></a>
  105. <p>To test an assertion, you write it in an &lsquo;<samp>#if</samp>&rsquo;. For example, this
  106. conditional succeeds if either <code>vax</code> or <code>ns16000</code> has been
  107. asserted as an answer for <code>machine</code>.
  108. </p>
  109. <div class="smallexample">
  110. <pre class="smallexample">#if #machine (vax) || #machine (ns16000)
  111. </pre></div>
  112. <p>You can test whether <em>any</em> answer is asserted for a predicate by
  113. omitting the answer in the conditional:
  114. </p>
  115. <div class="smallexample">
  116. <pre class="smallexample">#if #machine
  117. </pre></div>
  118. <a name="index-_0023assert"></a>
  119. <p>Assertions are made with the &lsquo;<samp>#assert</samp>&rsquo; directive. Its sole
  120. argument is the assertion to make, without the leading &lsquo;<samp>#</samp>&rsquo; that
  121. identifies assertions in conditionals.
  122. </p>
  123. <div class="smallexample">
  124. <pre class="smallexample">#assert <var>predicate</var> (<var>answer</var>)
  125. </pre></div>
  126. <p>You may make several assertions with the same predicate and different
  127. answers. Subsequent assertions do not override previous ones for the
  128. same predicate. All the answers for any given predicate are
  129. simultaneously true.
  130. </p>
  131. <a name="index-assertions_002c-canceling"></a>
  132. <a name="index-_0023unassert"></a>
  133. <p>Assertions can be canceled with the &lsquo;<samp>#unassert</samp>&rsquo; directive. It
  134. has the same syntax as &lsquo;<samp>#assert</samp>&rsquo;. In that form it cancels only the
  135. answer which was specified on the &lsquo;<samp>#unassert</samp>&rsquo; line; other answers
  136. for that predicate remain true. You can cancel an entire predicate by
  137. leaving out the answer:
  138. </p>
  139. <div class="smallexample">
  140. <pre class="smallexample">#unassert <var>predicate</var>
  141. </pre></div>
  142. <p>In either form, if no such assertion has been made, &lsquo;<samp>#unassert</samp>&rsquo; has
  143. no effect.
  144. </p>
  145. <p>You can also make or cancel assertions using command-line options.
  146. See <a href="Invocation.html#Invocation">Invocation</a>.
  147. </p>
  148. <hr>
  149. <div class="header">
  150. <p>
  151. Previous: <a href="Implementation-limits.html#Implementation-limits" accesskey="p" rel="prev">Implementation limits</a>, Up: <a href="Implementation-Details.html#Implementation-Details" accesskey="u" rel="up">Implementation Details</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html#Index-of-Directives" title="Index" rel="index">Index</a>]</p>
  152. </div>
  153. </body>
  154. </html>