NotNull pointers
Walter Bright
newshound2 at digitalmars.com
Wed Aug 31 13:02:56 PDT 2011
On 8/31/2011 4:46 AM, Steven Schveighoffer wrote:
> Seg faults are not as useful as asserts. It's a fact.
You might be surprised, then, that I'll often temporarily replace an assert with
a HLT instruction so I can use a debugger on it :-)
> If you have a seg fault,
> you must reproduce the error while in a debugger, or generate a core dump.
> Reproducing not be possible, or might take considerable time. Any argument
> against this is revisionist history. Yes, if I go back in time and run it in a
> debugger for that execution, it would be useful. Yes, if I go back in time and
> change my shell options to generate a core dump, it would be useful. If you have
> an assert, you get a stack trace, no need to reproduce the assert in a debugger,
> or enable non-default settings in your shell. It just gives you the information
> you need.
It's also possible for the program to have its own seg fault handler that reads
its own symbolic debug info and generates a line number and stack trace. There
was a patch to Phobos that did this a while back.
Optlink's register dump on a seg fault is not Windows' doing, it installs a seg
fault handler which does this.
> So 4 instructions per assert of a class reference (which is arguably not
common) is a lot of bloat?
15 bytes. And yes, this stuff adds up surprisingly quickly, especially if you're
the type that wants to leave the asserts on even in release mode.
More information about the Digitalmars-d
mailing list