gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Nit


From: Charles Duffy
Subject: Re: [Gnu-arch-users] Nit
Date: Tue, 21 Oct 2003 17:13:55 -0500

Tom,

One effective difference between C and Java: While there may be some
necessity of having an effective handler for any given error, Java's
syntax allows clumping rather than checking individually.

If one is running three subsequent calls, each of which may return an
I/O error, such that the appropriate handling is appropriate for any I/O
error within the three, it's certainly convenient to be able to simply
have a try/catch block providing a single handler for an I/O error
thrown by any of the three rather than explicitly writing a jump in at
each possible point. This isn't necessarily "every call site",
therefore, as one handler can apply to multiple lines of code.

Can exactly the same behaviour be had in C? Of course -- but the code
gets a bit less clean (as the error-checking is per call rather than per
block of calls), and the lack of a compiler screaming YOU DIDN'T SAY
WHAT TO DO ABOUT THIS EXCEPTION, YOU DIMWIT! means a bit more dicipline
is required.

Of course, as long as we've got a maintainer who's willing to yell YOU
DIDN'T DO ANYTHING THAT VAGUELY RESEMBLES ERROR HANDLING IN THIS CODE,
YOU DIMWIT! then we'll prolly do all right with C anyhow. :)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]