Spec#, nullables and more

Jesse Phillips jessekphillips+D at gmail.com
Fri Nov 5 15:38:00 PDT 2010


Leandro Lucarella Wrote:

> And then, you can corrupt memory with something like:
> 
> struct S {
> 	int[1_000_000_000] data;
> 	int far_data;
> }
> 
> S* s = null;
> s.far_data = 5;
> 
> If you are unlucky enough to end up in a valid address. That might not
> be a practical example, of course, but theoretically null pointer could
> lead to memory corruption.

Interesting, I get this:

test.d(13): Error: index 1000000000 overflow for static array

I'm not exactly sure what you are trying to demonstrate with it. Are you filling up the stack such that the OS tries to assign to a proper data field? How is it still not trying to access location 0 causing an Access Violation? 


More information about the Digitalmars-d mailing list