[phobos] enforce() vs. assert() for range primitives

Sean Kelly sean at invisibleduck.org
Sun Aug 22 15:32:55 PDT 2010

On Aug 22, 2010, at 5:07 PM, Walter Bright wrote:
> Sean Kelly wrote:
>> I think it depends on how the compiler dereferences fields of an object. GCC on OSX if I have a null ptr to a struct and I try to access a field through it I'll get the data at 0x4 or wherever and the code will keep on running.  Actual segfaults happen depressingly rarely. 
> On Windows, the entire first 64K of address space is reserved by the OS, and any attempt to access it results in a seg fault. I'm very surprised that OS X would not do the same.

I misspoke before, this behavior is on OpenSolaris.  The segfaults we get are all when dereferencing corrupt pointers into unallocated memory.  For whatever reason, the first 64K isn't locked... at least for reading, I haven't explicitly tested writing.

More information about the phobos mailing list