if (e1) return e2; [else] s1;
Mike Schilling
mikes at rtech.UUCP
Mon Mar 26 06:59:18 AEST 1990
>From article <10624 at alice.UUCP>, by ark at alice.UUCP (Andrew Koenig):
> Some people take the view that except at the end of a function,
> `return' is just a funny way of spelling `goto.'
A shop of horrors I once worked in used the following coding standard, thinking
it was good style:
1. Only one return statement per function.
2. No goto's, even for error handling.
3. Tabs are eight spaces wide, as ASCII intended.
The result, of course, was that any function which did input argument
checking began its useful life indented at least 32 spaces, and ended:
}
}
}
}
return(error_status);
}
I've always thought that leaving the main processing code once it's
clear that special error processing is needed makes code both easier to read
and more maintainable.
----------------------------------------------------------------------------
mikes at rtech.com = Mike Schilling, Ingres Corporation, Alameda, CA
Just machines that make big decisions,
Programmed by fellows with compassion and vision. -- Donald Fagen, "IGY"
More information about the Comp.lang.c
mailing list