[comp.lang.ada] When to run "exit" code

stt@inmet.inmet.com (05/25/90)

Re: writing "exit-time code" in Ada83

Using priority to accomplish "exit code" (a.k.a. finalization)
is non-portable, but will probably work in most mono-processor
implementations.  I have seen a few other clever tricks, but
have unfortunately forgotten them (there might be someone
out there on the net with some clever scheme).

I know that a number of compilers have a library-level cleanup
mechanism, used by their own RTS to close files, etc.  You might
be able to plug into one of those (still non-portable) mechanisms.

In any case, general "finalization" emerged quite early
in the Ada9X process as a useful enhancement to Ada.  We are considering
it quite seriously.  When combined with exception handling,
abort, terminate, etc., it is far from trivial to define
and efficiently implement, but we are trying...  

C++ has it now, but alas, they
don't have those other things (exceptions, etc.).  Now that
Bjarne Stroustrap is considering adding exceptions to C++, I am sure
he will have some interesting things to say about the interactions
with finalization (aka "destructors" in C++).

S. Tucker Taft
Ada9X Mapping/Revision Team
Intermetrics, Inc.
Cambridge, MA  02138