Boost logo

Boost :

From: Andrey Semashev (andysem_at_[hidden])
Date: 2007-04-06 16:00:38


Hello Hans,

Friday, April 6, 2007, 11:28:46 PM, you wrote:

> I don't think the goal is being fast, although that would be a plus.

For me the performance is of high concern. I expect the
BOOST_SCOPE_EXIT performance to be comparable to a hand-written scope
guard like that:

struct guard
{
  ~guard()
  {
    // guard body
  }
};

Another thing I expect is the guard's construction error safety. I.e.
it may not involve things like dynamic memory allocations, TLS slot
acquirement, etc., and should minimize copying of any user's objects.

> As long as the two solutions don't differ in their uses, I don't care
> on the implementation, but ASM is not portable, and I better like a
> less easy to use but same interface on every platform.

> BOOST_SCOPE_EXIT {
> // ...
> }
> (msc-only) versus
> BOOST_SCOPE_EXIT( (hello)(world) ) {
> // ...
> }
> (on everything) is a clear choice for me.

I guess, the interface may be the same across platforms. I'm fine with
the second one you mentioned.

> On 6-Apr-07, at 3:11 PM, Andrey Semashev wrote:

>> Hello Alexander,
>>
>> Friday, April 6, 2007, 11:00:51 PM, you wrote:
>>
>>> Alexander Nasonov wrote:
>>>> I reimplemented the macro and I see the problem but I already made
>>>> up my mind: use portable solution when possible and rely on asm
>>>> magic of __thread global on msvc.
>>> ^ or
>>> Sorry for the typo.
>>
>> IMHO, asm much is better. __thread has problems in dll and besides, I
>> suspect, is slower.

-- 
Best regards,
 Andrey                            mailto:andysem_at_[hidden]

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