Returning a reference to be manipulated

Dennis dkorpel at gmail.com
Sun Apr 16 11:31:48 UTC 2023


On Saturday, 15 April 2023 at 21:00:01 UTC, kdevel wrote:
> On Saturday, 15 April 2023 at 15:50:18 UTC, Dennis wrote:
>> [...]
>> care about the type / mutability of the pointer.
>
> Returning `i`'s address in a long does not trigger the escape 
> detector:

It doesn't care about the type of pointer, but it does care about 
whether the type is/has a pointer in the first place. `T*`, 
`T[]`, `K[V]` (Associative arrays), `class`, `function`, 
`delegate` are pointers. Static arrays and structs depend on what 
they contain. Basic types such as `long` are not pointers, so 
lifetime checking doesn't apply.



More information about the Digitalmars-d-learn mailing list