From: "Robert I. Eachus" <rieachus@attbi.com>
Subject: Re: ISO/IEC 14519 - Ada POSIX binding
Date: Sat, 21 Jun 2003 21:04:50 GMT
Date: 2003-06-21T21:04:50+00:00 [thread overview]
Message-ID: <3EF4C83F.40400@attbi.com> (raw)
In-Reply-To: my2Ja.52092$hz1.127695@sccrnsc01
tmoran@acm.org wrote:
> There is an exception
> Posix.Posix_Error to force the program not to ignore problems. The
> program must then get the particular error code and figure out what to do.
> I suppose that might translate into "when others =>" in a case statement
> in old code, but it would be a bad programmer indeed who decided "There's
> an error. I don't understand it. I'll just pretend I didn't notice it".
Right, while in C, the normal situation is to ignore the possibility
that an error code will be returned. With the Posix binding, an Ada
exception is raised, so it will find an exeception handler (or terminate
the task silently). A programmer can still "ignore" the error, it is
just a lot more visible if they do. (when others => null;)
Oh, and I have been asked many times why tasks disappear silently if an
exception occurs after elaboration. This is one of those things that
falls in the third part of the standard. (What happens if you try to
shoot yourself in the foot.) You are not required to have an exception
handler in a task body. But if there is the remotest chance of an
exception reaching a handler, the handler should be there. Even if it
just prints an error message. So why isn't it required?
Because there are several tasking idioms, and the right place for the
catchall error handler differs. For example:
task body Foo is
...;
begin
loop
begin
accept ...;
...
exception
...
end;
end loop;
end Foo;
Requiring an exception handler outside the loop would be silly. Not
having an execption handler inside the loop is also silly. Another example:
task body Bar is
begin
declare
...
begin
accept ...;
...
exception
...
end;
end Bar;
Here the author of the task body decided to encapsulate everything
inside a declare block, either so that elaborating the declarations
happens as part of the task, not its creator, or so that execptions
occuring in the declarations are handled inside the task. In either
case requiring another exception handler for the task body as a whole
would just be a pain.
next prev parent reply other threads:[~2003-06-21 21:04 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-19 21:43 ISO/IEC 14519 - Ada POSIX binding Mark Lorenzen
2003-06-19 21:29 ` tmoran
2003-06-28 23:48 ` Richard Riehle
2003-06-20 11:57 ` Marin David Condic
2003-06-20 14:08 ` Ludovic Brenta
2003-06-20 16:39 ` Warren W. Gay VE3WWG
2003-06-20 18:33 ` tmoran
2003-06-20 19:09 ` Warren W. Gay VE3WWG
2003-06-21 19:14 ` Florian Weimer
2003-06-21 19:42 ` tmoran
2003-06-21 21:04 ` Robert I. Eachus [this message]
2003-06-29 15:05 ` Florian Weimer
2003-06-20 19:24 ` Georg Bauhaus
2003-06-20 20:49 ` Warren W. Gay VE3WWG
2003-06-20 20:49 ` Wesley Groleau
2003-06-20 23:05 ` Mark Lorenzen
2003-06-21 1:49 ` David Emery
2003-06-21 19:19 ` Florian Weimer
2003-06-21 21:47 ` David Emery
2003-06-21 22:22 ` Larry Kilgallen
2003-06-23 16:13 ` Warren W. Gay VE3WWG
2003-06-23 22:41 ` Berend de Boer
2003-06-24 9:52 ` Lutz Donnerhacke
2003-06-24 20:43 ` Berend de Boer
2003-06-25 9:02 ` Pascal Obry
2003-06-25 9:46 ` Lutz Donnerhacke
2003-06-25 21:19 ` Berend de Boer
2003-06-21 13:01 ` Pascal Obry
2003-06-21 12:11 ` Marin David Condic
2003-06-21 12:44 ` Ludovic Brenta
2003-06-21 13:03 ` Larry Kilgallen
2003-06-21 22:28 ` Ludovic Brenta
2003-06-22 3:45 ` Larry Kilgallen
2003-06-22 8:47 ` Mark Lorenzen
2003-06-23 16:36 ` Warren W. Gay VE3WWG
2003-06-24 11:46 ` Marin David Condic
2003-06-21 19:09 ` Florian Weimer
2003-06-21 22:38 ` Mark Lorenzen
2003-06-21 22:51 ` Ludovic Brenta
2003-06-23 16:54 ` Warren W. Gay VE3WWG
2003-06-24 11:49 ` Marin David Condic
2003-06-24 13:31 ` Warren W. Gay VE3WWG
2003-06-23 16:46 ` Warren W. Gay VE3WWG
2003-06-23 22:43 ` Berend de Boer
2003-06-29 15:10 ` Florian Weimer
2003-06-29 20:58 ` David Emery
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox