
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