This is also nice for cases where it just doesnt make sense to "return"
right away... it would reduce the outer glue logic for the function, and
reduce the number of "accompanying" functions that handle the case where
you return 0;
Perhaps though, a similar effect can be obtained using a
exception e;
do {
if (foo)
{ e = 1; break; }
if (bar)
{ e = 2; break; }
// normal case.
} while (0);
if ( e == 1 )
// handle it
else if ( e == 2 )
// handle it
Let exception be an arbitrary struct where essential information is
stashed to be passed outside of the logic to the handler.
Does anyone else know of any techniques for doing "exception handling" in
C? Any cleaner ways we could do this?
On Wed, 10 Sep 1997, Linus Torvalds wrote:
> But supporting hints about which way is the likely branch would be good.
> I'd prefer something like
>
> __builtin_unlikely_if (x) {
> }