lkml.org 
[lkml]   [1997]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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) {
> }


\
 
 \ /
  Last update: 2005-03-22 13:40    [W:0.099 / U:0.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site