Boost logo

Boost :

Subject: Re: [boost] gcc4.3 warning for multiple scope exits
From: Kim Barrett (kab.conundrums_at_[hidden])
Date: 2009-07-14 07:59:10


At 10:48 AM +0000 7/14/09, Alexander Nasonov wrote:
>boost::scope_exit::aux::holder<
> boost::scope_exit::aux::declare<
> sizeof(boost_scope_exit_args)
> >::apply<0>::apply_value
>> boost_scope_exit_args;
>
>If sizeof(boost_scope_exit_args) is equal to sizeof(declared),
>the resulting type would be holder<(0<0>::apply_value)>. But I don't
>see a global variable apply_value in your patch.

The added parenthesis in the above, in

   holder<(0<0>::apply_value)>

don't describe the actual parse and evaluation. Instead, that snippet
gets parsed and evaluated as

   holder<(0<0)>::apply_value

so that the whole (expression) statement (with disambiguating
parenthesis added) is

  holder<(0<0)>::apply_value > boost_scope_exit_args;

>BTW, I modified Steven's code and introduced a bug because
>sizeof(declare<sizeof(undeclared)>::apply<0>) does not necessarily
>equal to sizeof(declared).

Are you sure? Perhaps I'm missing something, but it looks to me like
those values should indeed be the same. The "apply" class template in
question has one member, of type "declared". Given that, I would be
surprised if the "apply" class template could have a different size
(or alignment) from the "declared" type.


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