At 7/11/97 Robert Eachus answered:
> Again, as I said, this is highly platform dependent, but...
> Finalization of the RHS occurs after assignment (and adjusting). The
>LHS is of course finalized before the assignment and components of an
>object are finalized before the entire object...
OK, I did not think of such things, instead I was talking about the following:
end Deep_Inner_Level; -- X is finalized here, no Adjust!
Now suppose this happens in a real-time system in a cyclic task.
Any stack will soon overflow...
For this to work properly, I used 'Unchecked_Access:
type Controlled is new Uncontrolled with record
Controller: Component := (Ada.Finalization.Controlled with
Within package Add_Finalization, this is absolutely safe. The simple
'Access would raise Constraint_Error.
The rest of your explanation, Robert, was rather specific to your solution of
the problem (which however you did not show - you *did* show the rather simple
case for limited types) and is still not very clear to me - and I suppose
neither to the rest of us.
By the way, the problem's originator Heath White ([log in to unmask]) is
I do not want to badger you into it, but I think it would make the discussion
much simpler if you let the cat out of the bag... (Some more animals?)
>...then Adjust comes along and can do its thing knowing the contents of the
>"old" value. If a Finalize doesn't have a corresponding Adjust, which in my
>program only occured at program termination, no big deal.
But I think a big deal in the above case!
So for now thankU for the lively discussion.