Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Unfortunately 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.



There 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: