Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's why we disable exceptions in video games.


We disable exceptions in video games due to lock contention when throwing exceptions on multiple threads in high core count situations?

No.

We disable exceptions in video games for dumb historical reasons that no longer apply.



Depends on the point of view.

https://youtu.be/6hC9IxqdDDw


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.


Since exception handling in desktop runtime environments usually takes an unbounded amount of time, it’s not good practice to use them in your main loop since you have to guarantee a new frame at 60Hz.

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.


Agreed about main loop — that requires special care.

But there's often lots of other stuff going on, such as IO in other threads. You wouldn't want that stuff in your main loop for the same reasons, so since it's segregated anyway, exceptions aren't so bad (usually).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: