3 ms·
absolutely—but I'm also not a fan of exceptions either & don't use them when I write C++. if you write your C++ in a mostly C-style, only taking C++ features he
by adamrezich 6y ago
absolutely—but I'm also not a fan of exceptions either & don't use them when I write C++. if you write your C++ in a mostly C-style, only taking C++ features here and there as you need them, the complexity of your code is often greatly reduced. again, this may only apply to game development—I haven't used C++ for anything else sizeable, aside from school assignments years ago.
- Koshkin 6y agoBut even in C you have to handle "exceptional situations" somehow... Like, for example, malloc() or fopen() returning NULL (which both could appear in the same block, by the way).
- adamrezich 6y agosure, which is why you handle those sort of things in your file-loading and memory-allocating routines accordingly. for high-performance game development you don't malloc() very often, and if you don't have enough memory to run the game, then you handle that by displaying a message or something and then ending the game. you only fopen() in a few specific places when loading resources, and if that fails, then either you made a mistake as a programmer or the user's assets are corrupted. either way, you display a message or something and end the game. in both cases, there's no need to pollute your entire codebase with the headache of exceptions. like I said, this mindset might be domain-specific, I'm not sure, I haven't used C++ meaningfully for anything else.