ctrl+c and destructors

Walter Bright newshound2 at digitalmars.com
Tue Oct 1 19:30:41 PDT 2013


On 10/1/2013 3:37 PM, Jonathan M Davis wrote:
> On Tuesday, October 01, 2013 23:17:01 deadalnix wrote:
>> 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.

Right. A null pointer dereference is a logic bug in your program, and hence the 
program needs to stop immediately, not execute "cleanup" code.

If there's one notion I'd like to terminate with prejudice, it's the notion that 
a running program can "recover" from bugs in itself.




More information about the Digitalmars-d mailing list