Pointers - Is it safe to point to invalid memory?

Brother Bill brotherbill at mail.com
Sun Aug 17 02:03:53 UTC 2025


On Sunday, 17 August 2025 at 01:44:38 UTC, Monkyyy wrote:
> On Sunday, 17 August 2025 at 01:19:41 UTC, Brother Bill wrote:
>> Merely pointing to an invalid address will not produce UB 
>> (undefined behavior)
>
> I linked you to the gc #wontfix list, it's explicitly the magic 
> words "UB".
>
> Idk what's actually happens(ub isn't a useful distinction), 
> someone would have to extensively test it, but it's expressly 
> not "do whatever" someone must've tried the xor linked list and 
> found it doesn't work in some case.
>
> An invalid pointer outside common use patterns could confuse 
> the GC and some invalid pointers are *known* to confuse the 
> GC(they should've keep the code rather then their wontfix list 
> *tsk*)

Understood.  Wild garbage pointers will confuse the GC.
Will a pointer just after a slice confuse the GC, or is the GC 
expecting this case?


More information about the Digitalmars-d-learn mailing list