Question regarding LRM 5.95 7.6(19)
: : their presence too.
:
: I was under the impression that any object that is initialize'd or
: adjust'ed _will_ always get finalize'd. However, some objects may
: (potentially) get finalize'd more than once and/or get finalize'd
: without ever being initialize'd or adjust'ed.
:
: I have reference counting that depends on this behavior.
: Am I safe? Lawyers? Compiler writers?
:
if your assumption is
nb_init + nb_adjust <= nb_finalize
you are safe from the compiler generated code point of view, but
beware of sneaky users that would call directly Initialize (those
operations better not be visible to the end programmer...)
if your assumption is
nb_init + nb_adjust = nb_finalize
you are safe in the limited case only. As a matter of fact, in the
non-limited case:
My_Ctrl_Obj : My_Ctrl_Type := (Controlled with ....);
will not generate a call to Initialize not Adjust (or if it does, in
case an anonymous object is generated, then the anon must be finalized
do there is still one more finalization)
I must say that I have been very surprized to find out that a
controlled object could be neither initialized nor adjusted...
Cyrille
--
------------------------------------------------------------------------
Gnat Project US phone: (212) 998-3489