Forked GC explained

frame frame86 at
Tue Sep 6 22:31:06 UTC 2022

On Monday, 5 September 2022 at 18:35:02 UTC, Steven Schveighoffer 
> On 9/5/22 7:12 AM, frame wrote:
>> And what if the programmer has no actual reference but wrongly 
>> forced a `free()` through a pointer cast?
> * Do not store pointers into non-pointer variables using casts 
> and other tricks.
> ```d
> void* p;
> ...
> int x = cast(int)p;   // error: undefined behavior
> ```
> The garbage collector does not scan non-pointer fields for GC 
> pointers.
> Note that this does not require the forked GC to cause this 
> problem.
> -Steve

Well, of course it would be the fault of the programmer. I did 
ask this because I just want to know if there is any catch of 
this (probably not intended/yet noticed) violation of some third 
party lib. I don't want do debug this :D

More information about the Digitalmars-d-learn mailing list