
30 Mar
2010
30 Mar
'10
12:23 p.m.
Stewart, Robert wrote:
How does one mix code wanting exceptions with code not wanting them?
Pretty easy (bad_alloc aside (*)), since the only way to get an exception when doing integer operations is to divide by zero (**). So code not wanting exceptions needs only not divide by zero - problem solved. This of course assumes that the exceptions are not delayed via a signaling NaN with the express purpose of making your life difficult by turning unary op+/- into a throwing operation. (*) And by the way, out of memory is not overflow. It's possible to run out of memory while computing an integer that is smaller than another integer that already has been computed. This is not what overflow means. (**) OK, sqrt(-1) throws as well.