How to use D without the GC ?

Vinod K Chandran kcvinu82 at gmail.com
Wed Jun 12 20:31:34 UTC 2024


On Wednesday, 12 June 2024 at 18:57:41 UTC, bachmeier wrote:
>
> Try `foo[10] = 1.5` and `foo.ptr[10] = 1.5`. The first 
> correctly throws an out of bounds error. The second gives 
> `Segmentation fault (core dumped)`.

We can use it like this, i think.
```
struct Foo {
   double * ptr;
   uint capacity;
   uint legnth;
   alias data this;

}
```
And then we use an index, we can perform a bound check.
I am not sure but I hope this will work.




More information about the Digitalmars-d-learn mailing list