4 ms·
Can't you disable exceptions?
by _benton 2y ago
Can't you disable exceptions?
- kevin_thibedeau 2y agoYes, but the C++ library becomes inherently broken because there is no error reporting.
- int_19h 2y agoOnly the parts that need to heap-allocate. Which includes most containers, but not e.g. algorithms.
- kevin_thibedeau 2y agoIt's everything that throws, which covers a lot more than STL, including <algorithm>.
- int_19h 2y agoThere are relatively few things that throw, though, unless they allocate. Stuff like e.g. vector::at() is not particularly interesting since it's easy to avoid and doesn't affect other things.
- _benton 2y agoI'm pretty sure Google, LLVM, Firefox etc use the stdlib without exceptions so it's probably possible. You can retrieve the error with errno right?
- kevin_thibedeau 2y agoThey're all YOLOing on the assumption that errors won't happen and doing the system programmer's favorite error handling scheme of calling abort(), then restarting a process. That doesn't fly on an embedded device. Nobody seriously checks errno after every library call without a separate means to indicate a failure happened in the first place.