What are some better ways to avoid the do-while(0); hack in C++?
It is considered acceptable practice to isolate these decisions in a function and use returns instead of breaks. While all these checks correspond to the same level of abstraction as of the function, it is quite logical approach. For example: void foo(…) { if (!condition) { return; } … if (!other condition) { return; } … Read more