[RFC] Throwing an exception with null pointers

a11e99z a at a.com
Mon Apr 14 09:49:27 UTC 2025


On Saturday, 12 April 2025 at 23:11:41 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> I've been looking once again at having an exception being 
> thrown on null pointer dereferencing.

null pointer in x86 is any pointer less than 0x00010000

also what about successful dereferencing 0x23a7b63c41704h827? its 
depends: reserved this memory by process, committed, mmaped etc

failure for any "wrong" pointer should be same as for 
0x0000....000 (pure NULL)

so read barrier is wrong option (maybe good for DEBUG only for 
simple cases)

silent killing process by OS is also wrong option, not every 
programmer is kernel debugger/developer or windbg guru

imo need to dig into .net source and grab their option


More information about the Digitalmars-d mailing list