ctrl+c and destructors

Jonathan M Davis jmdavisProg at gmx.com
Tue Oct 1 15:37:20 PDT 2013


On Tuesday, October 01, 2013 23:17:01 deadalnix wrote:
> On Tuesday, 1 October 2013 at 19:55:17 UTC, monarch_dodra wrote:
> > On Tuesday, 1 October 2013 at 03:58:04 UTC, Nick Sabalausky
> > 
> > wrote:
> >> You know, this sounds like something that really should fall
> >> squarely in
> >> the category of "do the right thing by default". Is there any
> >> reason
> >> druntime can't be made to handle this better by default?
> > 
> > Well, arguably, a segfault is a catastrophic error, even more
> > serious than an assert.
> 
> It shouldn't in a language that have nullable type as default.

I don't see why that's relevant. If you hit a segfault - regardless of whether 
it's because of a memory corruption or a null pointer or whatever - it's an 
error that should terminate your program. If we checked for null pointers and 
threw NullPointerError instead of segfaulting, it would be no different except 
that it would be an Error being thrown. Both it and segfaults are supposed to 
kill your program without doing cleanup.

- Jonathan M Davis


More information about the Digitalmars-d mailing list