4 ms·
The complexity of C++ really does come from the yes/no decisions that every project, library, and code path get to take. Do you know if a library call will thro
by lumost 4y ago
The complexity of C++ really does come from the yes/no decisions that every project, library, and code path get to take. Do you know if a library call will throw? hopefully they commented their code well! even better if they maintained comments for all of their dependencies...
- ncmncm 4y agoMight a library call throw? Assume yes. Next question.
- swiftcoder 4y agoAnd since about half of all game codebase are compiled with -fnoexcept... that means we are left assuming that all library calls may randomly crash or corrupt the stack
- lumost 4y agoso what am I to do? wrap all libraries in a try/catch call? Run tests and hope I've exhaustively verified all possible states?
- ncmncm 4y agoCatch exceptions at a few select spots where you actually know something meaningful to do about them. Keep cleanup code in destructors, where it always runs reliably. Avoid triggering exceptions too hard to recover from. That might involve work, but less work than fielding error codes would have been. There is no free lunch.