#9236 closed Bugs (wontfix)
Catch programmer errors with asserts, not exceptions
Reported by: | Domagoj Šarić | Owned by: | John Maddock |
---|---|---|---|
Milestone: | To Be Determined | Component: | multiprecision |
Version: | Boost 1.54.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
e.g. "powm requires a positive exponent."
Change History (5)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
comment:3 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:4 by , 9 years ago
- I wrote all those tickets in a bit of a hurry so I didn't check whether that one source code line I pasted is actually the one I ran into when stepping through your code
- regardless, aren't exceptions for exceptional cases outside of a programmer's direct influence (network, filesystem, memory allocation,...)? IOW isn't an invalid input to a function a programmer error?
- apply other comments on EH from #9234...
comment:5 by , 9 years ago
It's not a programmer error if the arguments come from user input (for example).
Note:
See TracTickets
for help on using tickets.
I believe this to be a true runtime error which should be checked and reported via an exception. Note that if you pass an unsigned integer as the exponent then the check is omitted, and in any case the cost of the check likely to be insignificant compared to the rest of the code.
There are however some inconsistencies in the way these checks are applied, which I'll fix shortly.