tags:

views:

201

answers:

3

While I am excited that C++0x will be much more fun to program in than C++98, I sometimes feel that some of the new features leave something important to be desired.
For e.g. initializer lists can not be deduced as references to arrays, variadic templates don't allow for member packs or arbitrary expression expansion, local classes can't be templates or contain templates or have in-class member initializers, lambdas can't be templates, constexpr can't help with compile time processing of string literals, user defined string literals can't be templates (whereas user defined number literals can be), decltype behaves significantly different in certain cases based on whether you parenthesize its operand or not (would have preferred a separate 'exprtype').

I recognize that the standard's committee had to make some very difficult choices and compromises (since it really isn't meant to innovate, and because it has fairly limited resources), and I respect them deeply and am very grateful to them for doing what they do. This post isn't meant to denigrate their efforts (I am very much looking forward to using C++0x) - but to gauge how strongly others feel about some of these features.

With that in mind, I pose to you the following questions:

1) What are the new features that you are completely satisfied with?
2) What are the new features that you are partially satisfied with - and what would it take to make you more satisfied?
3) What are the new features that you wish had definitely not been added?

For a list of all the features, I will refer you to Stroustrup's List.

Thanks!

+1  A: 

It's good they have alignment and memory model and thread local stuff. That should have been in ten years ago and there's no reason it should have taken so long.

The delegating constructors is something I wanted forever, but the implementation is horrible. If that's the best they can do it should be removed.

Pretty much everything else is just added complication and yet more initializer list nonsense. Which is why it's impossible to make delegating constructors properly. They should be trying to simplify the language, not add yet more metaprogramming complexity that makes so many problems.

Charles Eli Cheese
lambdas add complication? Or `auto` Or the range-based for loop? Rvalue references might add complexity for library developers, but they also enable major performance improvements, even for library *users* who never even need to see a rvalue reference.
jalf
Adding is pretty much the definition of complicating. More rules to learn, more places for compilers to mess up, and in C++'s case an ever expanding encouragement of remaking the language on the fly and the bizarre initialization nonsense and the const weirdness and the type explosion and if you don't think that these changes will complicate things dramatically (as most new revisions do) then you are more than a little naive.
Charles Eli Cheese
+2  A: 

I'm very annoyed by many things in C++0x. All of them from the same reason -- while the new features are absolutely brilliant, the need of backwards-compatibility makes many of them look like ugly hacks...

Example 1:

SequenceClass(std::initializer_list<int> list);

instead of

SequenceClass(int... list); // or other nice in-language way

Example 2:

class D [[base_check]] : public B {
    void sone_func1 [[override]] ();

instead of

class D : public B {
    override void sone_func1 ();

Example 3:

std::shared_ptr<Target> m_target;

instead of

Target ^ m_target;

... okay, that last one is my own happiness :>

Of course all of these are subjective -- many people prefer it otherwise. What annoys me is the fact that we have to keep backwards compatibility so the language can't fully evolve. This is ESPECIALLY annoying in cases of safety -- I'd really like to see C-style casts go away...

I really hope that C++ will someday adapt a "deprecation" mechanism, akin to what Khronos did to OpenGL since 2.0.

Kornel Kisielewicz
C++ does have a deprecation mechanism; std::auto_ptr for example
Terry Mahaffey
I'd wish they'd deprecate C-style casts, and implenet a -wdeprecated flag in gcc/MSVC -_-
Kornel Kisielewicz
A: 
  1. lambdas, auto, rvalue references
  2. templated typedefs; I think the syntax is awkward, but I'm glad they exist in some form
  3. Concepts. Oh wait... I win
Terry Mahaffey