Boost logo

Boost :

Subject: Re: [boost] [transact] code in sandbox
From: strasser_at_[hidden]
Date: 2010-02-17 10:03:56


Zitat von "Stewart, Robert" <Robert.Stewart_at_[hidden]>:
>> control ctrl;
>> while(true){
>> try{
>> transaction tx;
>> commit_on_destruction destr(tx);
>> try{
>> do{
>> ctrl=break_;
>>
>> //...user code
>> if(something) break;
>> else if(something_else) continue;
>> else return 5;
>> //...end user code
>>
>> ctrl=none;
>> break;
>> }while((ctrl=continue_),false);
>> }catch(...){
>> destr.nullify();
>> throw;
>> }
>> break;
>> }catch(isolation_exception &){}
>> };
>> if(ctrl==continue_) continue;
>> else if(ctrl==break_) break;
>
> Couldn't you avoid the inner try block by detecting a pending
> exception in ~commit_on_destruction()?

because of how std::uncaught_exception() works that would fail if the
macros are used inside a destructor that is called during exception
unwinding:

http://www.gotw.ca/gotw/047.htm


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