comp.lang.ada
 help / color / mirror / Atom feed
* Aborting a recursive subprogram by an exception
@ 2014-08-28 19:26 Victor Porton
  2014-08-28 19:59 ` Victor Porton
  0 siblings, 1 reply; 2+ messages in thread
From: Victor Porton @ 2014-08-28 19:26 UTC (permalink / raw)


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?

-- 
Victor Porton - http://portonvictor.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Aborting a recursive subprogram by an exception
  2014-08-28 19:26 Aborting a recursive subprogram by an exception Victor Porton
@ 2014-08-28 19:59 ` Victor Porton
  0 siblings, 0 replies; 2+ messages in thread
From: Victor Porton @ 2014-08-28 19:59 UTC (permalink / raw)


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-08-28 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-28 19:26 Aborting a recursive subprogram by an exception Victor Porton
2014-08-28 19:59 ` Victor Porton

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