Re: memory management



alex goldman <hello@xxxxxxxx> writes:

> As I understood from reading the Ada tutorial for C/C++ programmers,
> "access" is essentially like C++ smart pointer,

No, Ada access types are just pointers -- no "smarts".
To make something like smart pointers, you can use
controlled types.

>... except that you don't need
> to do anything to dereference it.

Dereference of access types uses the syntax ".all", but it's allowed to
be implicit in most contexts (for example, X.Y means X.all.Y, if X
is an access value (pointer)).

> How will the following work:
>
> Record A contains "access" to record B;
> record B contains "access" to record A.
>
> If I create an instance of one of them with "new", will it be destroyed when
> "access" to it goes out of scope?

No.

- Bob
.