Memory safe in D

Steven Schveighoffer schveiguy at gmail.com
Tue Mar 12 19:00:11 UTC 2024


On Tuesday, 12 March 2024 at 17:42:14 UTC, Walter Bright wrote:
> On 3/12/2024 6:57 AM, Steven Schveighoffer wrote:
>> I may have mentioned this before, but the way to fix this is 
>> in `@safe` code, before each reference with a constant offset 
>> that you know to be greater than one page, validate the root 
>> pointer is not null.
>
> I had thought the compiler already checked for that. But 
> testing shows it does not. I wonder if there was a PR to remove 
> it?

I don't know if that was ever present.

>
>> FWIW, I was actually talking about environments where the null 
>> page does not segfault, like in a kernel.
>
> I wonder why anyone would design it that way.

e.g.: https://en.wikipedia.org/wiki/Zero_page#Interrupt_vectors

-Steve


More information about the Digitalmars-d mailing list