Jumping into blocks

franka at mmintl franka at mmintl
Tue Apr 29 17:40:00 AEST 1986


In article <737 at bentley.UUCP> kwh at bentley.UUCP writes:
>So, assuming that goatooze are acceptable for error handling, but jumping
>into a block is forbidden, what's the best way to write this?  Use two
>branches, and hide the common code at the bottom of main()?

Yes.  Exception handlers belong at the bottom of the routine.  It isn't
"hidden" there -- that's the first place I would look for it.  I would
describe it as being hidden in your code (for whichever case it is being
jumped to).

Duplicating the code is also acceptable.  It depends mostly on a comparison
of two considerations: (1) how likely are there to be more instances where
the code is to be used in later versions of the routine, and (2) how likely
is it that later versions will want a different error message for the two
cases?

Frank Adams                           ihnp4!philabs!pwa-b!mmintl!franka
Multimate International    52 Oakland Ave North    E. Hartford, CT 06108



More information about the Comp.lang.c mailing list