Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-09-03 14:32:02


Hartmut Kaiser wrote:
> Daniel Frey wrote:
>
> Concatenating two tokens with the '##' operator, where the result isn't
> a new valid token results in undefined behaviour. In your sample it
> yields '>>', which is a valid token, so it is well defined. In other
> contexts two consecutive '>' characters are always interpreted as '>>'
> and not as two single '>'.

That wasn't my point :)

> But this isn't the point here. The '>>' was not formend by a '##'
> operator but by plain consecutiveness:
>
> #define SOME_MACRO(T) <T>
> SOME_MACRO(some_class<...>) // expands to <some_class<...>>

Exactly. But the expanded <some_class<...>> is the result of the
preprocessor, so IIRC the two >'s are treated as two tokens, not as one,
because they weren't glued together with ##. Also, the GCC preprocessor
expands the above to

< some_class<...> >

and I'm pretty sure that the rules for inserting spaces are exactly
defined and there is not much room for interpretation. If the GCC is
correct to insert spaces, then the patch is a work-around for a compiler
(here: preprocessor) bug. So, what is the correct behaviour here?

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk