Is if (condition) try {...} legal in C++?

Viewed 6847

For example:

if (true) try
{
    // works as expected with both true and false, but is it legal?
}
catch (...)
{
    // ...
}

In other words, is it legal to put the try-block right after the if condition?

4 Answers
Related