How does D handle null pointers?
Steven Schveighoffer
schveiguy at yahoo.com
Mon Aug 23 05:27:36 PDT 2010
On Fri, 20 Aug 2010 18:25:15 -0400, Adam Ruppe <destructionator at gmail.com>
wrote:
> This is brought up somewhat often on this group. Problem with throwing
> an exception in a segfault is that it is undefined behavior in POSIX.
So? Are we worried about damaging our well-running program after it
encounters a seg fault?
If 99.9% of the time, throwing an exception works on a segfault (which it
should on a null pointer access), and every once in a while, it just
crashes without a trace, I think we'd be much better off.
I personally think even if we don't throw an exception, but print a full
stack trace, that would be fine. Limit the stack trace to N frames to
prevent an infinite loop when stack corruption has occurred, and I think
we'd be good to go.
-Steve
More information about the Digitalmars-d
mailing list