
Keith Burton wrote:
Jonathan Turkanis wrote: [snip]
It seems to me that in some cases developers will be able to reason that based on the numerators and denominators of the instances of rationals they explicitly construct and the type and number of operations they need to perform, no overflow will occur if they use, say, rational<int>. In some cases, they will reason incorrectly; this is the type of logic error which might be usefully signaled using assertions.
I hope you meant using exceptions as it is not possible to test all possible inputs to the calculations
No, I was claiming that in some cases a developer might know the range of all possible inputs, and be able to reason that no overflow could occur. If this reasoning is correct -- and usually one must trust the developer's judgment -- using exceptions would be unnecessary. Jonathan