Boost logo

Boost :

Subject: Re: [boost] [Boost.Breakable] Any interest in a Boost Breakable library?
From: Martin Törnwall (herede_at_[hidden])
Date: 2009-09-07 09:28:46


Pierre Morcello wrote:
> Hello,
>
> I propose a set of macros that allow to break anywhere. Example of use of the main macro :
>
> // do something...
> BOOST_BREAKABLE
> {
> if (test1)
> {
> break;
> }
> if (test2)
>
> {
>
> break;
>
> }
>
>
> std::cout<<"this is never reached if test1==true or test2==true. "<<std::endl;
> // do something...
> }
> // here the program continues ...
>
> Is there any interest in such a library?
>
> Best regards,
>
> Pierre Morcello
>
I think this is an excellent idea. Though the do...while(false) trick is
a rather handy one, I've always felt that it its purpose might not be
clear enough, especially to someone who has never encountered it before.
However, I agree with Thomas: this is a one-line macro, and it should be
portable between all standards compliant C++ compilers. There is simply
no need to create a library just for this feature. Perhaps you could
expand upon it a bit?

Regards,
Martin Törnwall


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