comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hyrosen@mail.com>
Subject: Re: Ada exceptions. unchecked?
Date: Thu, 13 Jun 2002 13:13:14 -0400
Date: 2002-06-13T13:13:14-04:00	[thread overview]
Message-ID: <3D08D2AA.1020502@mail.com> (raw)
In-Reply-To: 3D08CB6F.D68F18DE@san.rr.com

Darren New wrote:
> I suspect the point in Java was to *force* you to deal with it.
 > How many C programmers write something like
> 
>   buffer = malloc(size);
>   fill_in_buffer(buffer, size);
>   write(handle, buffer, size);
> 
> without checking that malloc succeeded or that the write actually wrote the
> right number of characters? If malloc() and write() threw exceptions that
> you were *required* to catch or declare, you couldn't get away with this.
> The real problem is callbacks and exceptions, not just the declared
> exeptions.

The point is to force the program to deal with problems.
So in your example, malloc will throw an exception if it
fails to allocate memory, and write could throw if it is
given a null pointer. That's fine. And at some point in
the program we could have an exception handler that deals
with this. But why does every intervening function in the
call tree have to state for the record that it knows that
something it calls may throw such an exception, if it is
not the place where the exception is handled?




  reply	other threads:[~2002-06-13 17:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-12  7:00 Ada exceptions. unchecked? steve_H
2002-06-12 13:52 ` Ted Dennison
2002-06-12 14:09 ` Larry Kilgallen
2002-06-12 13:47   ` Mark Johnson
2002-06-12 15:40     ` Larry Kilgallen
2002-06-12 16:07       ` Darren New
2002-06-12 22:21         ` Dale Stanbrough
2002-06-13 14:36           ` Hyman Rosen
2002-06-13 16:41             ` Darren New
2002-06-13 17:13               ` Hyman Rosen [this message]
2002-06-13 17:48                 ` Darren New
2002-06-13 18:06                   ` Hyman Rosen
2002-06-13 18:37                     ` Darren New
2002-06-13 19:14                       ` Hyman Rosen
2002-07-05 14:35                         ` Stephen J. Bevan
2002-06-12 19:25     ` Simon Wright
2002-06-12 22:19     ` Gisle Sælensminde
2002-06-13 14:27       ` Mark Johnson
2002-06-14 21:32         ` Gisle Sælensminde
2002-06-14 21:45           ` Darren New
2002-06-15 15:10           ` Simon Wright
2002-06-15 21:26             ` AG
2002-06-15 23:37               ` Darren New
2002-06-15 23:50                 ` AG
2002-06-15 23:57                   ` Darren New
2002-06-17 18:21             ` Charles Lindsey
2002-06-18 16:32             ` Stephen Leake
2002-06-18 19:48               ` Wes Groleau
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox