Spec#, nullables and more

FeepingCreature default_357-line at yahoo.de
Sat Nov 6 14:33:45 PDT 2010


Walter Bright Wrote:

> FeepingCreature wrote:
> > Walter Bright Wrote:
> >> All that does is reinvent the null pointer seg fault. The hardware does
> >> this for you for free.
> > 
> > Walter, I know you're a Windows programmer but this cannot be the first time
> > somebody has told you this - YOU CANNOT RECOVER FROM SEG FAULTS UNDER LINUX.
> > 
> > Access violations are not a cross-platform substitute for exceptions.
> 
> Why would you want to recover from a seg fault?
> 
> (asserts in D are not recoverable exceptions)

You cannot do a lot of things from a signal handler. You can't sjlj, which means sjlj exception handling is out (as are, in fact, most methods of exception handling). This means stack traces are out unless you have special handling for segfaults that decodes the stack and prints the error pos. That in turn means you need to have a debugger attached to get stacktraces, which can be annoying especially in long-running programs where the crash is often the first indication you have of a problem.

Furthermore, scope guards will not be run. You can't run the GC from a signal handler because it requires pthreads which is not safe for signal handlers. Garbage collected classes will not be freed. Static class destructors cannot be run. Module destructures can not be safely executed.

Can I stop?



More information about the Digitalmars-d mailing list