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: Ben Burns
Subject: Re: [Gnu-arch-users] Nit
Date: Wed, 22 Oct 2003 20:09:46 +0200
User-agent: KMail/1.5.3

On Wednesday 22 October 2003 16:37, Tom Lord wrote:
>     > From: Thomas Zander <address@hidden>
>     >
>     > I understand your reasoning but I reject it due to the fact that
>     > my classes will not compile when the change you think will break
>     > things has occurred,
>
> The checking done by the compiler is approximate.  It will catch
> _some_ changes to throw lists, but not necessarily all.  That is, as
> nearly as I can tell, why the spec says the feature is intended to
> _reduce_ (not eliminate) the number of checked exceptions handled
> improperly.

The exception checking done by the Java compiler is not approximate, its just 
that there are a class of exceptions, RuntimeException's, that do not have to 
be declared but can be thrown and caught in the usual manner.  The 
NullPointerException is a RunTimeException, if it wasn't then (practically) 
every method would have to declare it.  

RunTimeExceptions are Exceptions are Throwable.  The other Throwable class is 
the Error.  An Error does not have to be declared by a method either, as 
these are normally considered to be uncatchable (OutOfMemoryError).

Otherwise, its all done by contract.  If a method declares that it throws an 
Exception then any callers must also throw that exception or deal with it.  
This is enforced by the compiler.

(http://www.codeguru.com/java/tij/tij0099.shtml)

I don't know how this applies to C :-)

Ben





reply via email to

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