Possible Duplicate:
Are do-while-false loops common?
Is there a reason to have code like:
do {
// a lot of code that only needs to be run once
} while (FALSE);
when the code isn’t defining a macro? I know it’s a trick when it comes to macros, but is there a reason for it in normal code?
Well, it does allow you to use the
break;(orcontinue) keyword for early exit if you have a need for that for some reason. That would be kinda ugly though. I’d really rather see it moved into its own routine, with the early exit implemented via areturn;statement.