D - Unsafe and doomed

Walter Bright newshound2 at digitalmars.com
Sat Jan 4 11:11:27 PST 2014


On 1/4/2014 9:13 AM, Thiez wrote:
> On Saturday, 4 January 2014 at 04:20:30 UTC, David Nadlinger wrote:
>> This is not true. While it _is_ possible to get null pointers in @safe code,
>> they are not a safety problem, as the first page is never mapped in any D
>> processes (yes, I'm aware of the subtle issues w.r.t. object size here, c.f.
>> Bugzilla). And if you find a way to obtain a dangling pointer in @safe code,
>> please report it to the bug tracker, this is not supposed to happen.
>
> What happens when you have an object/array/struct/whatever that is larger than a
> page, and access one of the members/indices that is more than one page-size away
> from the starting point? Wouldn't this cause memory corrupting if the second
> page is mapped and you have a NULL pointer?

Yes, it would.

Many systems, in order to deal with this, map out the first 64K, not just the 
first page. Java, to deal with this, makes objects larger than 64K illegal.


More information about the Digitalmars-d mailing list