What's the point of C++0x?

Started by
16 comments, last by way2lazy2care 12 years, 8 months ago
Hi, i've been programming in c++(well, mostly c) and delphi for almost 10 years now. I've started hearing about c++0x about a year ago, and i still don't get it. What's advantage would i gain from using it? I've heard that you can use rvalue as referance(pointer??), stuff like that wich seem pretty counter intuitive. My point is, is that new language extention just something to try to make c++ easyer for beginer to start with? Or will it just add even more complexity over a language that imo is pretty good as it is. The only thing i dont like in c++ is the lack of support for thread and networking, but that's easily overcomed if you create reusable class to manage this kind of stuff like i did.

So, as an hobbyist programmer, does it worth learning? One of my friend asked me what do i think about it, honestly i could't answer him since i have no idea what it is all about really. If anyone can explain to me some of the advantages of those new features, id like to know.

Thx for you're time.

Vortez.
Advertisement
Here's a good reference for the new features/changes:

http://en.wikipedia.org/wiki/C%2B%2B0x

The "point" is simply that it's a next version of the language. It's not "extensions", it's simply an evolution of what C++ is from this point on. The C++ you know and love is "C++98" or "C++03". This version is expected to be "C++11".


I don't think a central focus is to make it easier for beginners to start with. C++ is a high performance systems programming language meant to be able to get "close to the metal", and there are simply tradeoffs to make where adding essential capabilities will indirectly make the learning curve steeper. That said, there are lots of other features (for example, lambda functions) that make obsolete current tedious conventions and replace them with something much more elegant, which will indirectly make the learning curve easier.

In short, it adds lots of stuff and changes the way lots of existing stuff is done. As a C++ developer for several years, I welcome the changes. It will result in less code that's more readable, and get rid of some of the nasty hacks that we've come to love. It will also enable expressing new things, and new idioms will appear, which will evolve over time and make C++ better.
Seems like its about 10 years too late to be useful.

Seems like its about 10 years too late to be useful.


Why? It's not like everyone has moved on to other languages. There's still a ton of C++ programmers and code lying around. Also, many things that are being standardized we have been doing in C++ for years, except in a nonportable way (for example multithreaded programming)
I was talking with Paul Deitel the author of one of the most popular/selling C++ book and he said to me in a email :


"
With the exception of extreme performance computing, it's my belief that managed-code programming is the way to go. And in many performance oriented scenarios, it's probably better to use the managed languages and throw more computing power at them than to try to squeeze performance by using languages like C/C++, which are much more difficult to program in correctly.
Best,Paul
Paul J. Deitel, CEODeitel & Associates, Inc


"
He's fine to have those beliefs, but game development is "extreme performance computing", and it's not acceptable to sit back and "throw more hardware at it".

For consoles, there is no "more hardware" - you have what you're given, forever. Also, most consoles don't support JIT compilation.

For PC's, it means your competitors will automatically have all of the compute power you gave up to be able to use a managed language and at least be able to run on lower spec machines or at higher frame rates, or both. With garbage collected languages, it requires significant amount of effort to make sure the garbage collectors don't kick in at "the wrong time" and freeze your game for unacceptable periods of time.

I don't agree with the argument that managed languages solve many problems in game engine runtime development.
As a lounge thread...
I am not excited about 0x. Ok, some features are cool but I don't plan to use them short-term. I'm considering some mid-term but they recently all took a serious blow. Most are just "meh" in my opinion. Among the most interesting:

[font="Courier New"]foreach[/font]: it's only a few years late (has been around as extension for a while but this is better).
lambda functions: the only feature I'm seriously considering. I wished they used a different syntax but it's personal opinion.
Object ctor improvement: at last. Perhaps they were waiting for us to send them cake.
[font="Courier New"]override[/font]: this reduces the potential for misuse and slip errors. Good, although I would have done it differently.
utf-8-16-32: it's only ... like 10 years late? Good to have this at last.
[font="Courier New"]int64[/font]: it's only 10 years late. Could have introduced 128-bit vector types while they were at it!
Better rand: ok, good. A bit late IMHO.

Only lambda functions are so good everyone should not go along without looking into them. Oldschool C++ is still good.

Previously "Krohm"


... but game development is "extreme performance computing", ...

That's not quite correct. Some areas of game developement are extreme performance computing. Game development as a whole has many levels of performance requirements. Casual games don't usually require extreme performance. Most indies games don't require it. Even many genres of AAA games don't require it.




I don't agree with the argument that managed languages solve many problems in game engine runtime development.

Depends on the features in that game engine, doesn't it? See above. wink.gif

In the end, it's going to be as it's always been - cutting edge graphical games are going to need to use C++ in most cases. The only thing holding developers to C++ for everything is existing code bases and platforms they want to target.

Former Microsoft XNA and Xbox MVP | Check out my blog for random ramblings on game development

[font="Courier New"]static_assert [/font]is beyond price. And it's a language construct, not a macro/template hack.

[font="Courier New"]constexpr, decltype, [font="Arial"]variadic templates, l[/font][/font]ate return type are, in addition to lambda, some of the more useful features, and each in their own way, priceless.

Reassigning the [font="Courier New"]auto [/font]keyword to something useful is a great convenience, especially in situations with complicated template hierarchies that you don't truly care about as long as the compiler can verify that the types are correct. Initializer list support is not something you absolutely need, but a great convenience, especially because they can be made to work everywhere, and the standard library implements them.

[font="Courier New"]sizeof [/font]and constructors finally work the way they should, [font="Courier New"]explicit [/font]finally works as it should, unions finally are allowed to work the correct way (as most compilers did anyway), [font="Courier New"]long long[/font] finally isn't a "non portable extension" any more. More expressive makeup is possible for default constructors, which admittedly is no big deal, but is nice anyway.
The standard library has seen a major overhaul with a lot of useful new (and improved) classes, such as smart pointers or tuples (and much in my opinion less useful stuff such as complicated math functions and random generators etc. -- still it makes the standard library more complete).

All in all, I wonder why the vast majority of programmers is so terribly negative about C++0x. Yes it is late. Yes, talking of 0x in mid-2011 is stupid. Yes, it would have been nice to have the same things 5 years ago. Yes, there is always something extra that we could use. Yes, my neighbour says C# is so much better.

So what.

We have a major update for the C++ language at your hands, and it really works great. It's a tool, and the tool has been improved and extended in many ways.
If someone does not like the tool or thinks that another one is better, fine. If someone does not want to use the new C++0x features, fine. No problem there, really.
[color=#1C2837][size=2]For PC's, it means your competitors will automatically have all of the compute power you gave up to be able to use a managed language[/quote]

But you're ignoring the competitive power that using a managed language gives you: faster development time. Your competitors don't "automatically" have anything -- there's a time cost involved.

This topic is closed to new replies.

Advertisement