3 ms·
That is not a programmer error, this is a domain error mostly for math functions or string parsing. (Other than relatively evil std::length_error/out_of_range w
by AstralStorm 9y ago
That is not a programmer error, this is a domain error mostly for math functions or string parsing. (Other than relatively evil std::length_error/out_of_range which might go either way.)
In most cases where it is a bit gratuitously thrown it can be avoided.
You might want as well to redefine any error as a programmer error.
- mehrdadn 9y ago> That is not a programmer error, this is a domain error mostly for math functions or string parsing. ....what in the world? no... for domain errors there's, erm, std::domain_error. C++ Reference/StackOverflow/MSDN/etc. already explain all these. But it seems I have to copy-paste them here? "Domain and range errors are both used when dealing with mathematical functions." [1] "std::logic_error reports errors that are a consequence of faulty logic within the program such as violating logical preconditions or class invariants and may be preventable." [2] "std::domain_error may be used by the implementation to report domain errors, that is, situations where the inputs are outside of the domain on which an operation is defined." [3] [1] https://stackoverflow.com/a/641972 https://stackoverflow.com/a/641972 [2] http://en.cppreference.com/w/cpp/error/logic_error http://en.cppreference.com/w/cpp/error/logic_error [3] http://en.cppreference.com/w/cpp/error/domain_error http://en.cppreference.com/w/cpp/error/domain_error