Spec#, nullables and more
    Michel Fortin 
    michel.fortin at michelf.com
       
    Fri Nov  5 17:42:46 PDT 2010
    
    
  
On 2010-11-05 20:04:11 -0400, Walter Bright <newshound2 at digitalmars.com> said:
> Michel Fortin wrote:
>> On 32-bit OS X, that limit is 4 KB.
> 
> That's good to know.
Well, you should already know. I posted this on the Phobos mailing list 
in August and you posted a reply. :-)
>> And what happens if I dereference a null pointer to a static array of 
>> 65k elements and I try to read the last one?
> 
> Array index out of bounds.
There's nothing out of the array's bounds in this case. Here's what I meant:
	byte[66000]* arrayPtr = null;
	byte b = (*arrayPtr)[66000-1];
I'm in the array's bounds here, the problem is that I'm dereferencing a 
null pointer but the program will actually only read 65999 bytes 
further, outside of the 64 KB "safe" zone.
Should we limit static arrays to 64 KB too?
-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
    
    
More information about the Digitalmars-d
mailing list