4 ms·
> That is one of those legacy options people complain about because they aren't used by C. Have you seen how the C math library does error handling? It silentl
by josefx 5y ago
> That is one of those legacy options people complain about because they aren't used by C.
Have you seen how the C math library does error handling? It silently writes to errno. I can just imagine the runtime using the trap to do just that and continue as if nothing happened.
- adrian_b 5y agoUnfortunately the default is like you say. However all C/C++ compilers have options to detect and report or trap on all common errors, but few people use these compiling options, because of a usually baseless fear that they might reduce the performance more than acceptable. In the cases when the performance is indeed too low for correct execution, the complaints should be directed to the CPU manufacturers who are guilty of this (by neglecting the architectural features needed for handling many kinds of exceptions, which were considered mandatory in older CPUs), instead of improving the performance of the programs by cheating, i.e. by omitting the error checks and by accepting that the programs may have horribly wrong behaviors in seldom cases.
- ncmncm 5y agoThere is a long-standing principle in system design: do not check for an error condition that you cannot do anything about. It is the responsibility of whoever is so equipped either to ensure that you cannot encounter such an error, or to have provided a path to deal with the error. In C++ you can throw an exception, and count on anybody who cares to act on it, resolving the conflict.