
23 Mar
2007
23 Mar
'07
6:50 p.m.
Martin Bonner wrote:
Why not throw an exception? Any overhead only occurs when an error has actually happened, not on every operation. Not quite. See below. Or even better:
if(error_condition) That is where the potential for additional overhead occurs. Now, how /serious/ it is, is an /entirely/ different matter. Obviously, it depends how much work it takes to calculate "error_condition", and how tight a loop we are in.
Absolutely: but unless you propose to have no error handling at all, the test is the same irrespective of whether we abort or throw or whatever, isn't it? What am I missing? Cheers, John.