NotNull pointers
Walter Bright
newshound2 at digitalmars.com
Wed Aug 31 13:05:52 PDT 2011
On 8/31/2011 7:14 AM, Sean Kelly wrote:
> It's worth mentioning that for some reason, Solaris doesn't protect the
> entire first page of memory--only the zero address. For accesses the where
> the compiler pre-computes the offset and reads that location directly, you
> won't get a segfault if the pointer is null (at least with GCC--haven't
> tested with Sun's compiler). This makes no sense to me and it's been the
> source of a ton of problems in C apps I've found. I'm just mentioning this
> because it's made me leery of relying on the hardware to flag null accesses.
Solaris is dead anyway :-)
Also, the virtual function table pointer is at offset 0 in the class object, and
that is the most likely one to be referenced.
And lastly, different code could be generated for Solaris targets.
More information about the Digitalmars-d
mailing list