Messages in this thread | | | Date | Fri, 12 Sep 1997 12:22:18 +0000 ( ) | From | Manong Dibos <> | Subject | Re: patch for 2.1.55 pre-1 minix/sysv/affs |
| |
Perhaps if C had good exception handling throw(), try{}, catch(){}, all this farting around with if()'s could be made a lot more streamlined... Just throw an exception at the first hint of a deviation from the "norm".
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) { > }
| |