How does D distnguish managed pointers from raw pointers?

Johan Engelen j at j.nl
Fri Oct 4 15:03:04 UTC 2019


On Thursday, 3 October 2019 at 14:21:37 UTC, Andrea Fontana wrote:
>
> In D arrays are fat pointer instead:
>
> int[10] my_array;
>
> my_array is actually a pair ptr+length.

```
int[10] my_static_array;
int[] my_dynamic_array;
```

my_static_array will not be a fat pointer. Length is known at 
compile time. Address is known at link/load time so it's also not 
a pointer but just a normal variable (& will give you a pointer 
to the array data).
my_dynamic_array will be a pair for ptr+length.

-Johan



More information about the Digitalmars-d-learn mailing list