Chromium code replaces exceptions with boolean flags and logging or code to kill the current process for bad cases like out-of-bound access.
Current hardware trends make C++ exceptions harder to justify
21–30 of 516 posts
Re: Current hardware trends make C++ exceptions harder to justify
#22That's why we disable exceptions in video games.
For AAA / high-performance / console / close-to-the-metal video games, at least. There are tons of games where exceptions are perfectly fine. Though still more often used for "probably going to crash soon" situations than otherwise, I'd wager.
You can definitely do it but you’d be conceptually allowing for frame skips in your codebase. It could be difficult to audit and remove this assumption if down the road you wanted to tighten up your main loop code.
Re: Current hardware trends make C++ exceptions harder to justify
#23Re: Current hardware trends make C++ exceptions harder to justify
#24I am convinced that maintaining ABI is a huge technical debt to C++. And that is largely occasioned by shared libraries.
Rust IMO made a fantastic decision to emphasize source distribution (and making it super easy via cargo and crates).
Re: Current hardware trends make C++ exceptions harder to justify
#25If not exception, then how to fail constructor?
Re: Current hardware trends make C++ exceptions harder to justify
#26Consider this crap small code fragment. Any function that returns void is almost certainly wrong.
Re: Current hardware trends make C++ exceptions harder to justify
#27I don't use them. I just create an error type and pass that around.
The only legitimate exception I will accept is when you access invalid memory. That's a special case and depending on the environment something extraordinary must happen.
But exceptions and exception handling just creates annoying code. It doesn't add value, not really.
Re: Current hardware trends make C++ exceptions harder to justify
#28That's why we disable exceptions in video games.
No.
We disable exceptions in video games for dumb historical reasons that no longer apply.
Re: Current hardware trends make C++ exceptions harder to justify
#29> As illustrational example consider this small code fragment: Consider this crap small code fragment. Any function that returns void is almost certainly wrong.
Re: Current hardware trends make C++ exceptions harder to justify
#30Why do we need to have ambient control flow? This is what exception handling is, it's a hidden control flow. I don't use them. I just create an error type and pass that around. The only legitimate exception I will accept is when you access invalid memory. That's a special case and depending on the environment something extraordinary must happen. But exceptions and exception handling just creates annoying code. It doe…