How to jump out of a C++ code block?
How about
do
{
...
if(condition)
break;
...
}
while (0);
I don't particularly like this style but I've seen it before. If refactoring is out of the question (could be for a massive block that can break a lot of stuff if changed), this is an option.
Here's one way:
switch(0) {
default:
/* code */
if (cond) break;
/* code */
}
(please never do this)