4 ms·
C++ is identical in speed to C, if you know what you're doing, even if you're using "advanced" features. The only thing C exceeds C++ in is simplicity. Yes you
by SomeCallMeTim 14y ago
C++ is identical in speed to C, if you know what you're doing, even if you're using "advanced" features. The only thing C exceeds C++ in is simplicity. Yes you CAN write slow code in C++, but if you need speed, it's there. In the parts of your code where speed isn't AS important, but you're not ready to drop to a scripting language, you can manipulate things with higher-level structures and smart pointers and such.
C++ plus scripting is the best way to go, IMO; you get object-oriented abstractions, better type safety at compile time, and yet you still get speed. Destructors alone make it worth using C++ over C, so you can ensure stack structures clean up on return from a function and can avoid using a "goto exit" model.
And if you need every last percent of speed, you can write that code in a "C" subset of C++. C is still completely there under the covers. Except you have to do more casting.
C is really not much better than a portable assembly language. And I should know, having written commercial games entirely in assembly language.