Why is C++ the industry standard?

Started by
37 comments, last by Washu 11 years, 10 months ago
I've seen a billion C++ vs. X-Language posts and the answer is always, whatever you prefer to code in is the better language. But what I want to know is; why is C++ the industry standard for game programming? Almost every reputable game company uses C++ for their games. What is so special about C++? I've never gone too deep in C++, I've picked up the book Accelerated C++, but I just can't seem to get the hang of it and I've always gone back to Java. Now I'm thinking of trying another C++ book, but that's getting off topic.

Thanks.
Advertisement
Because it works on all the platforms a game studio needs to target. Specifically: Xbox 360, PS3, and sometimes PC.

Its not a matter of a "want" to use C++, but a matter of "what is required to operate on this platform?"

That being said, indie developers can use XNA to target the Xbox 360 platform, with limitations of course.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Another common reason is for performance.
For some things, c++ can be faster than another language. That said, this isn't as good of a reason these days what with a lot of people being able to make games in x language and still get decent performance.

A third reason could be that it's been around a while and has a pretty big community and a lot of libraries for so many different things, as well as tons of documentation, tutorials, etc.
Also that existing (huge) code bases / libraries were in C and all the programmers knew C, so the change from C to C++ (which can be made in steps, since most C also works in C++) must have been easier than the alternatives. Just a thought, though.

Because it works on all the platforms a game studio needs to target. Specifically: Xbox 360, PS3, and sometimes PC.

Its not a matter of a "want" to use C++, but a matter of "what is required to operate on this platform?"

That being said, indie developers can use XNA to target the Xbox 360 platform, with limitations of course.


Does it mean that only C/C++ has compilers to all platforms? Why there isn't any compilers written to all platforms in other languages? Maybe there's not strong enough demand for that?

Does it mean that only C/C++ has compilers to all platforms? Why there isn't any compilers written to all platforms in other languages? Maybe there's not strong enough demand for that?


Most popular languages get compilers for all platforms eventually.

The problem really is that C and C++ are the de-facto standards, existing middleware, engines, etc are allready written in them and those will not get ported over that quickly(maybe not at all) if they have to be rewritten from scratch in a new language. This in turn means that a game platform without a C and a C++ compiler will fail miserably. (WP7 is a great example of what happens if you don't support native C++).

Since C++ almost has to be supported it is one of the few languages that a middleware writer can count on being supported on launch on a new platform which makes it the safest language to write new middleware in which keeps the cycle going.
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

Another common reason is for performance.
For some things, c++ can be faster than another language. That said, this isn't as good of a reason these days what with a lot of people being able to make games in x language and still get decent performance.


The reason you can do things with decent performance in x language, is because someone implemented low level library functions for what you wanted to do.
Usually implemented in C++ or C.
Most popular languages these days insist on runnning in a VM even though the benefits for video games are questionable compared to their runtime cost.

Few languages are designed to be compiled natively while still offering a diverse set of high level paradigms such as OO programming, meta programming and functional programming. There's basically mostly C++ and D that fit this category. Only one of those two is a mature language with a proven design and a huge ecosystem of tools, compilers, libraries, and frameworks.

Template meta programming in particular allows C++ to combine very good runtime performance with very good abstraction capabilities. There's pretty much no other language that have both of those things along with a big ecosystem.
it has a little thing called "pointer"

whatever you prefer to code in is the better language.


It is.

Over time, you then want to do more. And inevitably, no matter the language, you hit roadblocks. They may be big or small, related to performance, management, refactoring, overall development speed, platform support, open/proprietary issues, third-party library availability, ....

Then one looks around and realizes the choice of languages that can work around any of these is fairly limited. It's almost without exception C or C++.


Companies do not have time or budget to experiment. So they start with one thing which is designed to not have limitations.

Electric cars are fine. But if you want something that will work everywhere, you buy something that runs on gas.

This topic is closed to new replies.

Advertisement