Live data from Hacker News

How to write good code with C++11

channel9.msdn.com

31–34 of 34 posts

Re: How to write good code with C++11

#32
MS knows that Moore's Law doesn't mean faster cores anymore, rather more of them. But, most problems are only so parallelizable, thus the need to get the utter maximum serial performance (and no less important, minimum power consumption) that you can, out of code. This and, speed advances are going to come in good part from GPU parallelism and, I doubt you're going to get that through the CLR. Herb Sutter, head of the C++ team is all over this -- http://herbsutter.com/welcome-to-the-jungle. C++ and MS' emphasis on parallelism is them facing the future, as they should.

Re: How to write good code with C++11

#33
post #28

Earlier quoted context omitted.

>Each layer of convenience has a penalty. That's only true if you can beat the layer implementation, and frankly I don't know any programmers (including myself) that would beat a optimizing compiler in code generation. >It's not like software (especially games) is static, so that the managed/native gap will get insignificantly imperceptible at some point. Here you go : http://deltaengine.net/ - used in this game : ht…

That's only true if you can beat the layer, and frankly I don't know any programmers (including myself) that would beat a optimizing compiler in code generation. We're not talking writing assembly vs having the compiler do it, here. We're talking using a high level language with features such as garbage collection, bounds checking etc, versus not. Those kinds of layers are both expensive AND beatable, regardless of t…

>Those kinds of layers are both expensive AND beatable, regardless of the "optimizing compiler".

No - those layers were invented because those things were such common errors - ie. - most people got them wrong. So nope, most people aren't able to beat those in everyday code, and debugging is expensive. Performance is not the only metric, even in games, and you have to "beat" the other metrics as well - such as bug count/correctness and productivity. Maybe when you have AAA titles and can budget a few millions on dev team alone the equation looks different, and that's why I singled them out. But for small teams (mobile) and indies/amateurs .NET is good enough (and is being used).

And games regularly sacrifice performance for productivity, look up early unreal script (interpreted), and how it was often the bottle neck but was still used in development.

Re: How to write good code with C++11

#34

Earlier quoted context omitted.

I personally enjoyed reading the FQA, and even learned about some C++ "subtleties" in the process. I note however that the FQA itself has its share of criticism. http://stackoverflow.com/questions/3171647/errors-in-c-fqa

When reading this rebuttal, keep in mind that it was written in 2010 while the FQA was written starting in 2007, and apparently based on the author's experiences with much older tools. All other things aside, if your compiler frequently miscompiles templates, using them is probably not a good idea.

I agree. Also, C++11 probably makes a good deal of the FQA less relevant (except with regards to the sheer complexity of the language).

Also, I still agree with the basic premise of the FQA: for the majority of new projects where C++ is used, C++ is not the best tool for the job (not taking into account programmer expertise, though even then…).

Post reply on HN