1<html lang="en"> 2<head> 3<title>Obsolete Features - The C Preprocessor</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="The C Preprocessor"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Implementation-Details.html#Implementation-Details" title="Implementation Details"> 9<link rel="prev" href="Implementation-limits.html#Implementation-limits" title="Implementation limits"> 10<link rel="next" href="Differences-from-previous-versions.html#Differences-from-previous-versions" title="Differences from previous versions"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<!-- 13Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 141997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 152008, 2009, 2010, 2011 16Free Software Foundation, Inc. 17 18Permission is granted to copy, distribute and/or modify this document 19under the terms of the GNU Free Documentation License, Version 1.3 or 20any later version published by the Free Software Foundation. A copy of 21the license is included in the 22section entitled ``GNU Free Documentation License''. 23 24This manual contains no Invariant Sections. The Front-Cover Texts are 25(a) (see below), and the Back-Cover Texts are (b) (see below). 26 27(a) The FSF's Front-Cover Text is: 28 29 A GNU Manual 30 31(b) The FSF's Back-Cover Text is: 32 33 You have freedom to copy and modify this GNU Manual, like GNU 34 software. Copies published by the Free Software Foundation raise 35 funds for GNU development. 36--> 37<meta http-equiv="Content-Style-Type" content="text/css"> 38<style type="text/css"><!-- 39 pre.display { font-family:inherit } 40 pre.format { font-family:inherit } 41 pre.smalldisplay { font-family:inherit; font-size:smaller } 42 pre.smallformat { font-family:inherit; font-size:smaller } 43 pre.smallexample { font-size:smaller } 44 pre.smalllisp { font-size:smaller } 45 span.sc { font-variant:small-caps } 46 span.roman { font-family:serif; font-weight:normal; } 47 span.sansserif { font-family:sans-serif; font-weight:normal; } 48--></style> 49<link rel="stylesheet" type="text/css" href="../cs.css"> 50</head> 51<body> 52<div class="node"> 53<a name="Obsolete-Features"></a> 54<p> 55Next: <a rel="next" accesskey="n" href="Differences-from-previous-versions.html#Differences-from-previous-versions">Differences from previous versions</a>, 56Previous: <a rel="previous" accesskey="p" href="Implementation-limits.html#Implementation-limits">Implementation limits</a>, 57Up: <a rel="up" accesskey="u" href="Implementation-Details.html#Implementation-Details">Implementation Details</a> 58<hr> 59</div> 60 61<h3 class="section">11.3 Obsolete Features</h3> 62 63<p>CPP has some features which are present mainly for compatibility with 64older programs. We discourage their use in new code. In some cases, 65we plan to remove the feature in a future version of GCC. 66 67<h4 class="subsection">11.3.1 Assertions</h4> 68 69<p><a name="index-assertions-111"></a> 70<dfn>Assertions</dfn> are a deprecated alternative to macros in writing 71conditionals to test what sort of computer or system the compiled 72program will run on. Assertions are usually predefined, but you can 73define them with preprocessing directives or command-line options. 74 75 <p>Assertions were intended to provide a more systematic way to describe 76the compiler's target system and we added them for compatibility with 77existing compilers. In practice they are just as unpredictable as the 78system-specific predefined macros. In addition, they are not part of 79any standard, and only a few compilers support them. 80Therefore, the use of assertions is <strong>less</strong> portable than the use 81of system-specific predefined macros. We recommend you do not use them at 82all. 83 84 <p><a name="index-predicates-112"></a>An assertion looks like this: 85 86<pre class="smallexample"> #<var>predicate</var> (<var>answer</var>) 87</pre> 88 <p class="noindent"><var>predicate</var> must be a single identifier. <var>answer</var> can be any 89sequence of tokens; all characters are significant except for leading 90and trailing whitespace, and differences in internal whitespace 91sequences are ignored. (This is similar to the rules governing macro 92redefinition.) Thus, <code>(x + y)</code> is different from <code>(x+y)</code> but 93equivalent to <code>( x + y )<!-- /@w --></code>. Parentheses do not nest inside an 94answer. 95 96 <p><a name="index-testing-predicates-113"></a>To test an assertion, you write it in an ‘<samp><span class="samp">#if</span></samp>’. For example, this 97conditional succeeds if either <code>vax</code> or <code>ns16000</code> has been 98asserted as an answer for <code>machine</code>. 99 100<pre class="smallexample"> #if #machine (vax) || #machine (ns16000) 101</pre> 102 <p class="noindent">You can test whether <em>any</em> answer is asserted for a predicate by 103omitting the answer in the conditional: 104 105<pre class="smallexample"> #if #machine 106</pre> 107 <p><a name="index-g_t_0023assert-114"></a>Assertions are made with the ‘<samp><span class="samp">#assert</span></samp>’ directive. Its sole 108argument is the assertion to make, without the leading ‘<samp><span class="samp">#</span></samp>’ that 109identifies assertions in conditionals. 110 111<pre class="smallexample"> #assert <var>predicate</var> (<var>answer</var>) 112</pre> 113 <p class="noindent">You may make several assertions with the same predicate and different 114answers. Subsequent assertions do not override previous ones for the 115same predicate. All the answers for any given predicate are 116simultaneously true. 117 118 <p><a name="index-assertions_002c-canceling-115"></a><a name="index-g_t_0023unassert-116"></a>Assertions can be canceled with the ‘<samp><span class="samp">#unassert</span></samp>’ directive. It 119has the same syntax as ‘<samp><span class="samp">#assert</span></samp>’. In that form it cancels only the 120answer which was specified on the ‘<samp><span class="samp">#unassert</span></samp>’ line; other answers 121for that predicate remain true. You can cancel an entire predicate by 122leaving out the answer: 123 124<pre class="smallexample"> #unassert <var>predicate</var> 125</pre> 126 <p class="noindent">In either form, if no such assertion has been made, ‘<samp><span class="samp">#unassert</span></samp>’ has 127no effect. 128 129 <p>You can also make or cancel assertions using command line options. 130See <a href="Invocation.html#Invocation">Invocation</a>. 131 132 </body></html> 133 134