4 ms·
But 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
by Koshkin 6y ago
But 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.