Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-10-03 05:59:30


Daryle Walker writes:
> On 9/14/04 4:24 AM, "Aleksey Gurtovoy" <agurtovoy_at_[hidden]> wrote:
>
>> Joaquín Mª López Muñoz writes:
>>> The problem (see for instance http://tinyurl.com/4j87e) seems to be a
>>> trivial confusion with the digraph <:
>>>
>>> I guess all it takes to fix this is to rewrite line 35 in
>>> alignment_of_test.cpp
>>>
>>> #define ALIGNOF(x) align_calc<x>::get()
>>>
>>> as
>>>
>>> #define ALIGNOF(x) align_calc< x>::get()
>>>
>>> (note the extra blank). OK to commit?
>
> I think the other side of "x" needs space protection too, from ":>" and
> ">>".

This could never occur in this particular case (see the code), but in
general, yes.

> So the solution could be changed (again) to:
>
> #define ALIGNOF(x) align_calc< x >::get()
>
> BTW, can parentheses be used around "x" as better protection instead? Or
> does that work only for objects?

The latter.

>
>> Yes, please! (It's a bug in the compiler/preprocessor, of course).
>
> Not necessarily.

Sure it is.

> It depends on where digraph expansion is supposed to occur
> relative to macro expansion.

During tokenization, which happens before the macro expansion; see
the standard.

-- 
Aleksey Gurtovoy
MetaCommunications Engineering

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