On 8/30/11 8:19 PM, Walter Bright wrote:
On 8/30/2011 4:07 PM, Timon Gehr wrote:
You mean, in release mode the assert gets compiled out, and it seg
faults in the
code sequence that depends on the assertion, right?

Yes. Any dereference of a null class ref would cause a seg fault.

I am not afraid of seg faults so much, but in debug mode it is
certainly an
annoyance, because you don't get the source line and stack trace. I'd
say it
would be really nice if assert(classreference); would never seg fault
during
debugging.

Why? I rely on that for debugging. I run it under the debugger, seg
fault, bing the debugger shows where it faulted and a stack trace. It's
about 98% of what a debugger is good for.

Andrei will reply that there are some environments where you cannot use
a debugger, and he's right. But there are other workarounds for that - D
doesn't *prevent* you from doing soft debugging.


Is there any practical use for manually running the class invariant?

Looking for corruption of the data.


You loose time by having to run it under the debugger. If it just showed you the line of the null pointer it would be much faster to develop.

Reply via email to