Making alloca more safe

Walter Bright newshound1 at digitalmars.com
Mon Nov 16 12:55:57 PST 2009


dsimcha wrote:
> In a way you're right.  However, there is no universal answer for what to do about
> a null pointer except die **with a good error message explaining what went
> wrong**.  This is the part that's missing.  Right now you get an access violation.
>  I'd like an assert failure with a line number and a "Null pointer dereference"
> error message when I'm not in release mode.

You do get just that if you run the program under a debugger.

There was a patch for Phobos a while back which would use the debug data 
to print a stack trace on such an exception without needing a debugger. 
It has languished because nobody has spent the time to verify that it is 
correctly done and that it won't negatively impact anything else. I can 
forward it to you if you like and want to take a look at it.



More information about the Digitalmars-d mailing list