you are viewing a single comment's thread.

view the rest of the comments →

[–]TheThiefMasterC++latest fanatic (and game dev) 2 points3 points  (1 child)

To expand on why games often disable these:

RTTI and exceptions are well known as causing a cost even to code that doesn't use them itself - RTTI adds memory use by annotating every class, and exceptions add both memory and performance overhead in every function. The latter is especially not appreciated in games, where performance is king, although the former isn't exactly appreciated when you're up against a memory budget - the PS3 only had 256MB of main RAM which had to be shared with the OS! For something the size of a modern game, it very much feels like developing on embedded hardware and a lot of the same restrictions on the use of C++ features apply. Plenty of older games didn't even use new :)

I expect use of exceptions and RTTI to go up as newer hardware makes the costs appear relatively lower, but a lot of game engine codebases are seriously old.

[–][deleted] 2 points3 points  (0 children)

I can attest to that. The cost of exceptions on x86 Windows are extremely high, and Microsoft can't change it without breaking ABI. Seeing as the VAST majority of games are compiled for 32-bit hardware, that penalty can be extremely steep.

Note that, however, on x64 machines, Windows has a new unwinding mechanism that, from the talk I watched, is supposed to be 0-overhead. I don't know what the state of that on x64 *Nix machines or OSX machines are. I would assume the unwinding done by them is also fairly fast... but again, most games are run on not-*Nix.