News for hackers. Stuff that matters.
Re:The Hidden Cost of C++ by st3fan on Tuesday October 20, 2009 @01:39PM (#892852)
Wow it is C++ bashing season again it seems.

Yes you have to know what you are doing in C++. But this is not different in other languages. Understanding and optimizing code is a touch discipline. No matter what language.

There is also another side to this story. C++ can absolutely generate highly efficient code. Code that performs much better than C equivalents.

For example, I've looked a lot at generated (iPhone/ARM) code for cases where (function) templates are used and C++ wins most of the time. Doing compile-time configuration of code is usually much more efficient than having runtime-configured code. By using templates and inline functions the compiler can do some seriously cool performance tricks.

Sire, there may be more code (bigger text segment) but that is a small sacrifice for what you gain in speed. Specially these days where a 8MB fart app is easily downloaded over a 3G connection without hesitation.

Re:The Hidden Cost of C++ by groby_b on Tuesday October 20, 2009 @02:12PM (#892938)
Yes, you can use C++ to do amazing things. In large-scale projects, that usually backfires, though, unless you contain the "magic", because interactions in C++ are harder to predict.

The problem with C++ is not that you have to know what you are doing - you also have to know what everybody else is doing.

And the "small sacrifice" of a bigger text segment is a big one in this particular domain. We only have 512M available, and a tremendous chunk of that is eaten up by graphics. An executable seriously exceeding ~20MB would spell trouble.

And I'd argue that AAA games are slightly more complex than a fart app ;)

Re:The Hidden Cost of C++ by psyklic on Tuesday October 20, 2009 @03:35PM (#893141)
When I code in a team, we don't just write one big mass of C++ and hope that all the interactions work out okay!

Instead, we follow modular programming practices. If some interactions are too slow, we know who didn't optimize his section and we kick the problem back to him.

Re:The Hidden Cost of C++ by groby_b on Tuesday October 20, 2009 @03:45PM (#893171)
That would be nice. Except that - again, for performance reasons - we often have to break the boundaries between modules. Most game engines are a tangled web, since many parts are talking to many other parts. (I think there are ways around that, and there will certainly be a post on it. But that's the way things work right now)

So it's not always that easy to just find a guilty party and blame them.