"Roy T. Fielding" wrote:
> 
> I don't understand why you didn't simply reverse the test and
> enclose the frequent case inside the if {} block.  

D'oh!  of course!  commit coming shortly.

>               I assume it
> was just to avoid indenting a large block of code, which is not
> sufficient justification for a goto.

No, it just didn't occur to me at the time.  I wouldn't want to use that
technique for all of the error cases though.  Then the indentation would get out
of hand.

I've seen kernel level code that used a pattern like:

if (funky_error1) then {
    goto exit_with_error1;
}
do important stuff;
if (funky_error2) then {
    goto exit_with_error2;
}
do more stuff;
etc etc;

...which resulted in cache friendly code that this goto agnostic didn't have any
trouble reading.  I guess that pattern imprinted itself on my brain.

Greg

Reply via email to