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,8893269a4640c798 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-17 15:42:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fu-berlin.de!uni-berlin.de!82-43-33-75.cable.ubr01.croy.blueyonder.co.UK!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: terminate applications Date: Thu, 17 Jul 2003 23:44:17 +0100 Message-ID: References: <23ERa.75454$OZ2.12362@rwcrnsc54> NNTP-Posting-Host: 82-43-33-75.cable.ubr01.croy.blueyonder.co.uk (82.43.33.75) X-Trace: news.uni-berlin.de 1058481755 12339500 82.43.33.75 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Xref: archiver1.google.com comp.lang.ada:40445 Date: 2003-07-17T23:44:17+01:00 List-Id: "Mark A. Biggar" wrote in message news:23ERa.75454$OZ2.12362@rwcrnsc54... > If you really need to abort an Ada program form some > deeply nested code, raising an exception is a reasonable > way to do it. All clean up actions are guaranteed to > happen and you can add a handler to the main procedure > to do any last gasp stuff cleanly. Absolutely right. Furthermore, on reviewing the first example I gave, I see that it is rubbish! You cannot 'goto' out of a procedure in Ada. Sorry. Perhaps it could be corrected to the following: with Ada.Text_IO; use Ada.Text_IO; procedure exit_from_prog is Count: Natural := 0; My_Exception: exception; procedure Inner_Proc is begin Put_Line("Hello World"); if Count = 20 then raise My_Exception; end if; end; begin loop Inner_Proc; Count := Count + 1; end loop; exception when My_Exception => Put_Line("Clean termination!"); when others => Put_Line("Something unexpected!"); end; I have tested this on GNAT! The second example, and the reason why it is better, remains correct. -- Nick Roberts Jabber: debater@charente.de [ICQ: 159718630]