un-catched segfault exception

BCS BCS at pathlink.com
Fri Jan 11 08:33:25 PST 2008


Christopher Wright wrote:
> BCS wrote:
> 
>> Christopher Wright wrote:
>>
>>> What you can do, though, is convert a signal to an exception. It's 
>>> going to be a lot slower than just checking a pointer to see if it's 
>>> null, but if you have traced exceptions, the debugging benefit is 
>>> enormous. 
>>
>>
>> Why would this be slow? seg-v are caused by hardware. When a seg-v is 
>> noticed it triggers an interrupt and the OS goes from there. Until you 
>> get a seg-v there should be NO cost at all.
>>
>> Am I missing something?
> 
> 
> Handling an error will be slower. Handling a lack of an error will be 
> faster.

"Exceptions are a slow way to handle a seg-v's after it happens"

Ok that makes a difference. I missed that because 1) I generally assume 
that performance after an errors is not an issue and 2) in general my 
programs respond to a seg-v by quitting (with an uncaught exception) on 
the assumption that their is nothing else it can safely do.

I'd be interested in which of theses assumptions is erroneous in your 
case and why.



More information about the Digitalmars-d mailing list