I want this so badly, please implement

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 7 12:25:57 PDT 2016


On 4/7/16 2:14 PM, Adam D. Ruppe wrote:
> On Thursday, 7 April 2016 at 17:55:20 UTC, Steven Schveighoffer wrote:
>> Can't you throw a segfault in the handler? The information is still
>> there on the stack, no?
>
> Yes, of course, I can also printf the indexes myself. But the error
> could also carry a bit more useful information by default - and
> practically for free!
>
>
> I'm even actually almost sold on the null pointer exception people ask
> for. It has more cost than a RangeError with index (seriously, the index
> and length are *already loaded* in registers for the comparison, it
> really is as close to free as you can get), but the convenience of the
> message by default is nice - and you can still get the nice segfault
> when actually running in the debugger by breaking on the handler or
> whatever.

I hear you. I'm actually fervently on the side of having a seg fault 
printout of some kind (an exception may not be the best choice because 
with a seg fault, you can't trust the stack).

Having to deal with real world situations where a program runs for weeks 
and fails on a customer's system, just having "Segmentation Fault" 
staring at you is no help at all.

I'm sure you are in a similar situation with this. Instrumenting and 
running again is not only costly and time consuming, but may even 
subvert the actual problem (especially if it's timing sensitive).

-Steve


More information about the Digitalmars-d mailing list