Info Node: (cpp-300.info)Differences from previous versions
(cpp-300.info)Differences from previous versions
Differences from previous versions
==================================
This section details behavior which has changed from previous
versions of GNU CPP. We do not plan to change it again in the near
future, but we do not promise not to, either.
The "previous versions" discussed here are 2.95 and before. The
behavior of GCC 3.0 is mostly the same as the behavior of the widely
used 2.96 and 2.97 development snapshots. Where there are differences,
they generally represent bugs in the snapshots.
* Order of evaluation of `#' and `##' operators
The standard does not specify the order of evaluation of a chain of
`##' operators, nor whether `#' is evaluated before, after, or at
the same time as `##'. You should therefore not write any code
which depends on any specific ordering. It is possible to
guarantee an ordering, if you need one, by suitable use of nested
macros.
An example of where this might matter is pasting the arguments `1',
`e' and `-2'. This would be fine for left-to-right pasting, but
right-to-left pasting would produce an invalid token `e-2'.
GCC 3.0 evaluates `#' and `##' at the same time and strictly left
to right. Older versions evaluated all `#' operators first, then
all `##' operators, in an unreliable order.
* The form of whitespace betwen tokens in preprocessor output
Note:Preprocessor Output, for the current textual format. This
is also the format used by stringification. Normally, the
preprocessor communicates tokens directly to the compiler's
parser, and whitespace does not come up at all.
Older versions of GCC preserved all whitespace provided by the
user and inserted lots more whitespace of their own, because they
could not accurately predict when extra spaces were needed to
prevent accidental token pasting.
* Optional argument when invoking rest argument macros
As an extension, GCC permits you to omit the variable arguments
entirely when you use a variable argument macro. This is
forbidden by the 1999 C standard, and will provoke a pedantic
warning with GCC 3.0. Previous versions accepted it silently.
* `##' swallowing preceding text in rest argument macros
Formerly, in a macro expansion, if `##' appeared before a variable
arguments parameter, and the set of tokens specified for that
argument in the macro invocation was empty, previous versions of
GNU CPP would back up and remove the preceding sequence of
non-whitespace characters (*not* the preceding token). This
extension is in direct conflict with the 1999 C standard and has
been drastically pared back.
In the current version of the preprocessor, if `##' appears between
a comma and a variable arguments parameter, and the variable
argument is omitted entirely, the comma will be removed from the
expansion. If the variable argument is empty, or the token before
`##' is not a comma, then `##' behaves as a normal token paste.
* Traditional mode and GNU extensions
Traditional mode used to be implemented in the same program as
normal preprocessing. Therefore, all the GNU extensions to the
preprocessor were still available in traditional mode. It is now
a separate program and does not implement any of the GNU
extensions, except for a partial implementation of assertions.
Even those may be removed in a future release.
automatically generated byinfo2wwwversion 1.2.2.9