From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2d2df3e9ad18fa63 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-21 14:04:51 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc03.POSTED!not-for-mail Message-ID: <3EF4C83F.40400@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ISO/IEC 14519 - Ada POSIX binding References: <87vfuzqm4b.fsf@deneb.enyo.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.62.164.137 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc03 1056229490 24.62.164.137 (Sat, 21 Jun 2003 21:04:50 GMT) NNTP-Posting-Date: Sat, 21 Jun 2003 21:04:50 GMT Organization: AT&T Broadband Date: Sat, 21 Jun 2003 21:04:50 GMT Xref: archiver1.google.com comp.lang.ada:39541 Date: 2003-06-21T21:04:50+00:00 List-Id: 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.