Struct with default ctor (Was: [dmd-beta] dmd 2.064 beta take 2)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun May 19 12:51:36 PDT 2013


On 5/19/13 3:41 PM, deadalnix wrote:
> On Sunday, 19 May 2013 at 19:15:47 UTC, Andrei Alexandrescu wrote:
>> Oh, the good old "object of sufficient size". We know how to fix that.
>>
>>> And no, putting nullcheck on access of field of sufficient offset (as
>>> propose dby Andrei) isn't enough because we have value types. Consider :
>>>
>>> S[BIG_NUMBER]* a;
>>> auto s = &(*a[SLIGHTLY_BELLOW_CHECK_OFFSET]);
>>> s.fieldAccess; // May not have enough offset to trigget null check, but
>>> still can be usnafe
>>>
>>> See bug reports :
>>> http://d.puremagic.com/issues/show_bug.cgi?id=3677
>>> http://d.puremagic.com/issues/show_bug.cgi?id=5176
>>
>> All of the above are variations on the "sufficiently large object" theme.
>>
>> Andrei
>
> The code above never access a field with a sufficient offset to trigger
> "sufficiently large runtime check".

It does, when the pointer to the large static array is dereferenced.

Andrei


More information about the Digitalmars-d mailing list