我最近遇到过这段代码:
do {
if ( ! checkSomething() )
break;
// some code
if ( ! checkSomeOtherThing() )
break;
// some other code
} while(false);
// some final code
Run Code Online (Sandbox Code Playgroud)
编写它的程序员写了一条评论"cleaner control flow".
在我看来,如果原始代码重构为其他东西,它看起来会更好.但是这句话有什么道理吗?这个构造有什么用吗?