I'm not sure what you mean? In my experience, returns are generally grouped at the top.
void f(int x)
{
if (x < 0)
return;
do;
if (do.error)
return;
some;
work;
}
In lieu of any hinting, the if is assumed true; so the compiler will branch over the return in the nominal case.
You would need to write this to fix that bad prediction:
void f(int x)
{
if (x >= 0)
{
do;
if (!do.error)
{
some;
work;
}
}
}
You can see how the function body will accumulate unmitigated scopes now. That's just straight up bad code. (Linus would sack me on the spot if I wrote that!)
It's not at all unlikely to find functions that have several such checks in series... I won't write code that's an ugly sea of nesting.