What is the advantage of a do-while(false)?

Viewed 8669

When looking through some code that was handled by another employee, I see a lot of code written in:

do{
    ...
}while(false);

What advantage (if any) does this provide?

Here is more of a skeleton that is happening in the code:

try{
    do{
        // Set some variables

        for(...) {
            if(...) break;
            // Do some more stuff
            if(...) break;
            // Do some more stuff
        }
    }while(false);
}catch(Exception e) { 
    // Exception handling 
}

Update:

C++ Version:
Are do-while-false loops common?

14 Answers
Related