1<html lang="en"> 2<head> 3<title>Differences from previous versions - 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="Obsolete-Features.html#Obsolete-Features" title="Obsolete Features"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 131997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 142008, 2009, 2010, 2011 15Free Software Foundation, Inc. 16 17Permission is granted to copy, distribute and/or modify this document 18under the terms of the GNU Free Documentation License, Version 1.3 or 19any later version published by the Free Software Foundation. A copy of 20the license is included in the 21section entitled ``GNU Free Documentation License''. 22 23This manual contains no Invariant Sections. The Front-Cover Texts are 24(a) (see below), and the Back-Cover Texts are (b) (see below). 25 26(a) The FSF's Front-Cover Text is: 27 28 A GNU Manual 29 30(b) The FSF's Back-Cover Text is: 31 32 You have freedom to copy and modify this GNU Manual, like GNU 33 software. Copies published by the Free Software Foundation raise 34 funds for GNU development. 35--> 36<meta http-equiv="Content-Style-Type" content="text/css"> 37<style type="text/css"><!-- 38 pre.display { font-family:inherit } 39 pre.format { font-family:inherit } 40 pre.smalldisplay { font-family:inherit; font-size:smaller } 41 pre.smallformat { font-family:inherit; font-size:smaller } 42 pre.smallexample { font-size:smaller } 43 pre.smalllisp { font-size:smaller } 44 span.sc { font-variant:small-caps } 45 span.roman { font-family:serif; font-weight:normal; } 46 span.sansserif { font-family:sans-serif; font-weight:normal; } 47--></style> 48<link rel="stylesheet" type="text/css" href="../cs.css"> 49</head> 50<body> 51<div class="node"> 52<a name="Differences-from-previous-versions"></a> 53<p> 54Previous: <a rel="previous" accesskey="p" href="Obsolete-Features.html#Obsolete-Features">Obsolete Features</a>, 55Up: <a rel="up" accesskey="u" href="Implementation-Details.html#Implementation-Details">Implementation Details</a> 56<hr> 57</div> 58 59<h3 class="section">11.4 Differences from previous versions</h3> 60 61<p><a name="index-differences-from-previous-versions-117"></a> 62This section details behavior which has changed from previous versions 63of CPP. We do not plan to change it again in the near future, but 64we do not promise not to, either. 65 66 <p>The “previous versions” discussed here are 2.95 and before. The 67behavior of GCC 3.0 is mostly the same as the behavior of the widely 68used 2.96 and 2.97 development snapshots. Where there are differences, 69they generally represent bugs in the snapshots. 70 71 <ul> 72<li>-I- deprecated 73 74 <p>This option has been deprecated in 4.0. <samp><span class="option">-iquote</span></samp> is meant to 75replace the need for this option. 76 77 <li>Order of evaluation of ‘<samp><span class="samp">#</span></samp>’ and ‘<samp><span class="samp">##</span></samp>’ operators 78 79 <p>The standard does not specify the order of evaluation of a chain of 80‘<samp><span class="samp">##</span></samp>’ operators, nor whether ‘<samp><span class="samp">#</span></samp>’ is evaluated before, after, or 81at the same time as ‘<samp><span class="samp">##</span></samp>’. You should therefore not write any code 82which depends on any specific ordering. It is possible to guarantee an 83ordering, if you need one, by suitable use of nested macros. 84 85 <p>An example of where this might matter is pasting the arguments ‘<samp><span class="samp">1</span></samp>’, 86‘<samp><span class="samp">e</span></samp>’ and ‘<samp><span class="samp">-2</span></samp>’. This would be fine for left-to-right pasting, 87but right-to-left pasting would produce an invalid token ‘<samp><span class="samp">e-2</span></samp>’. 88 89 <p>GCC 3.0 evaluates ‘<samp><span class="samp">#</span></samp>’ and ‘<samp><span class="samp">##</span></samp>’ at the same time and strictly 90left to right. Older versions evaluated all ‘<samp><span class="samp">#</span></samp>’ operators first, 91then all ‘<samp><span class="samp">##</span></samp>’ operators, in an unreliable order. 92 93 <li>The form of whitespace between tokens in preprocessor output 94 95 <p>See <a href="Preprocessor-Output.html#Preprocessor-Output">Preprocessor Output</a>, for the current textual format. This is 96also the format used by stringification. Normally, the preprocessor 97communicates tokens directly to the compiler's parser, and whitespace 98does not come up at all. 99 100 <p>Older versions of GCC preserved all whitespace provided by the user and 101inserted lots more whitespace of their own, because they could not 102accurately predict when extra spaces were needed to prevent accidental 103token pasting. 104 105 <li>Optional argument when invoking rest argument macros 106 107 <p>As an extension, GCC permits you to omit the variable arguments entirely 108when you use a variable argument macro. This is forbidden by the 1999 C 109standard, and will provoke a pedantic warning with GCC 3.0. Previous 110versions accepted it silently. 111 112 <li>‘<samp><span class="samp">##</span></samp>’ swallowing preceding text in rest argument macros 113 114 <p>Formerly, in a macro expansion, if ‘<samp><span class="samp">##</span></samp>’ appeared before a variable 115arguments parameter, and the set of tokens specified for that argument 116in the macro invocation was empty, previous versions of CPP would 117back up and remove the preceding sequence of non-whitespace characters 118(<strong>not</strong> the preceding token). This extension is in direct 119conflict with the 1999 C standard and has been drastically pared back. 120 121 <p>In the current version of the preprocessor, if ‘<samp><span class="samp">##</span></samp>’ appears between 122a comma and a variable arguments parameter, and the variable argument is 123omitted entirely, the comma will be removed from the expansion. If the 124variable argument is empty, or the token before ‘<samp><span class="samp">##</span></samp>’ is not a 125comma, then ‘<samp><span class="samp">##</span></samp>’ behaves as a normal token paste. 126 127 <li>‘<samp><span class="samp">#line</span></samp>’ and ‘<samp><span class="samp">#include</span></samp>’ 128 129 <p>The ‘<samp><span class="samp">#line</span></samp>’ directive used to change GCC's notion of the 130“directory containing the current file”, used by ‘<samp><span class="samp">#include</span></samp>’ with 131a double-quoted header file name. In 3.0 and later, it does not. 132See <a href="Line-Control.html#Line-Control">Line Control</a>, for further explanation. 133 134 <li>Syntax of ‘<samp><span class="samp">#line</span></samp>’ 135 136 <p>In GCC 2.95 and previous, the string constant argument to ‘<samp><span class="samp">#line</span></samp>’ 137was treated the same way as the argument to ‘<samp><span class="samp">#include</span></samp>’: backslash 138escapes were not honored, and the string ended at the second ‘<samp><span class="samp">"</span></samp>’. 139This is not compliant with the C standard. In GCC 3.0, an attempt was 140made to correct the behavior, so that the string was treated as a real 141string constant, but it turned out to be buggy. In 3.1, the bugs have 142been fixed. (We are not fixing the bugs in 3.0 because they affect 143relatively few people and the fix is quite invasive.) 144 145 </ul> 146 147 </body></html> 148 149