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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!feeder.erje.net!eu.feeder.erje.net!news.etla.org!aioe.org!.POSTED!not-for-mail From: Victor Porton Newsgroups: comp.lang.ada Subject: Re: Aborting a recursive subprogram by an exception Date: Thu, 28 Aug 2014 22:59:40 +0300 Organization: Aioe.org NNTP Server Message-ID: References: NNTP-Posting-Host: AnnUDmZwVERVUXyHDyOl5A.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.13.3 X-Notice: Filtered by postfilter v. 0.8.2 Xref: number.nntp.dca.giganews.com comp.lang.ada:188711 Date: 2014-08-28T22:59:40+03:00 List-Id: Victor Porton wrote: > See also > http://stackoverflow.com/questions/25556441/aborting-a-recursive-subprogram-in-the-middle > > If I want to abort a recursive subprogram in the middle, is throwing an > exception from it a good way to do this? > > I am not sure whether exception optimizations allowed by Ada RM may not > nullify some external actions of the subprogram (such as modifying global > variables) which are before throwing the exception. > > Will it work with exceptions the right way? I see that it will work as it should. Ada2012 "11.6 Exceptions and Optimization" allows additional optimizations only for language-defined checks. Explicit "raise" statement should work as expected. -- Victor Porton - http://portonvictor.org