topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 2:31 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: C++0x: The Dawning of a New Standard  (Read 9344 times)

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
C++0x: The Dawning of a New Standard
« on: August 22, 2008, 02:55 AM »
Hi all.
Some new stuff on C++0x (the next-gen C++) has been release since I've been away and since no one else has posted, here we go...
Here is an article from DevX about C++0x including:
->Overview: C++ Gets an Overhaul
->An Introduction to Concepts
->Simpler Multithreading in C++0x
->The State of the Language
There is also this paper by Bjarne Stroustrup (Inventor of C++) which mouse man tells me is very good reading due to both the ideas expressed, and the information regarding the management of development divulged in its pages.
For the ultra-brave and uber-interested, you can access the Committee's mailings here.

For those of you not quite interested enough to go rummaging around the web, the main benefits thus far are slated to be:
  • enhanced memory model supporting modern machine architectures
  • threading ABI
  • mutexes and locks
  • thread local storage
  • asynchronous message exchange
  • regex support
  • hash table support
  • tuple (ordered list) support
  • improved date and time support
  • miscellaneous improvements for library creators
  • static assertion support
  • variadic template support
  • alignment control
  • delegating and inheriting constructors
  • auto keyword for deducing a type from an initializer
  • decltype keyword as a way of using the type of an expression in a declaration
  • nullptr keyword to describe the null pointer
  • range-based for loops (foreach) (yay)
  • lambda functions (yay)
  • raw string literals
  • UTF8 literals
  • concepts (a type system for template arguments)
  • in-class member initializers
  • shared_ptr<> keyword

Ehtyar.
« Last Edit: August 22, 2008, 03:56 PM by Ehtyar »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: C++0x: The Dawning of a New Standard
« Reply #1 on: August 22, 2008, 06:48 AM »
Yesterday I read the (59 page) paper "Evolving a language in and for the real world: C++ 1991-2006" by Stroustrup, and can highly recommend it for a variety of reasons.

The article is like an updated, more concise version of his book "The Design and Evolution of C++", which I also recommend, though it's somewhat dated at this point.

The paper is a fascinating combination of technical discussion on language design conflicts, historical explanation for why things are they way they are, and political history of how hard it can be to manage a standards committee.  Some very cool insider stuff.

I'm someone who has been coding in c++ for 20 years and has a love/hate relationship with the language.  As I've discussed elsewhere I am not thrilled with C++0x.  In fact it wouldn't surprise me terribly if the release of c++0x doesn't hasten the demise of the language.

However, I do think that there is an incredible amount to be learned from the decisions and struggles of the C++0x process, and it's must read stuff for anyone interested in the art of programming language design.

(if you are interested in this kind of stuff, do make sure you read the critique of c++ by Ian Joyner that i mention on the other thread).
« Last Edit: August 22, 2008, 06:55 AM by mouser »

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
Re: C++0x: The Dawning of a New Standard
« Reply #2 on: August 22, 2008, 07:01 AM »
In response to your not being thrilled with C++0x, I must say if C# was portable to a similar to extent as C++, I'd be there in short order. However, as mouse man knows, I am greatly adverse to proprietary languages, and I refuse to be taken up on C# by Microsoft. Perhaps something like D may strike my fancy if/when they get their finger out.

Ehtyar.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: C++0x: The Dawning of a New Standard
« Reply #3 on: August 22, 2008, 08:21 AM »
I think stuff like UTF8 literals is a mistake - internationalization resources really should be moved to external files.

I wonder why nullptr is necessary, '0' is clean enough in source code? (but perhaps this is template-magic related).

Dunno about regex being a core part of the language; it's useful, but you won't know about the speed of implementations if you're doing cross-platform stuff, so you're probably better suited using a thing like PCRE...

Threading and TLS support is a big win, I just hope the ABI for it is non-retarded.

foreach and lambda support is going to be cooooool :)

As a whole, I'm pretty mixed on C++0x. There's a bunch of good stuff in it, a bunch of whatever stuff, and a bunch of stuff that I feel will make the C++ platform somewhat bloated and a lot more effort for vendors to deploy. Also, it's a bit too late, and if you want to do cross-platform code, you probably won't have C++0x available on a lot of the platforms you're writing for...
- carpe noctem

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
    • View Profile
    • Donate to Member
Re: C++0x: The Dawning of a New Standard
« Reply #4 on: August 22, 2008, 01:40 PM »
I wonder why nullptr is necessary, '0' is clean enough in source code? (but perhaps this is template-magic related).

Regular old overloading and plain old readability.

I like nullptr.  The rationale from the nullptr proposal (http://www.open-std....apers/2004/n1601.pdf):

  • Distinguishing between null and zero. The null pointer and an integer 0 cannot be distinguished well for overload resolution. For example, given two overloaded functions f(int) and f(char*), the call f(0) unambiguously resolves to f(int).1 There is no way to write a call to f(char*) with a null pointer value without writing an explicit cast (i.e., f((char*)0)) or using a named variable.
  • Naming null. Further, programmers have often requested that the null pointer constant have a name (rather than just 0). This is one reason why the macro NULL exists, although that macro is insufficient. (If the null pointer constant had a type-safe name, this would also solve the previous problem as it could be distinguished from the integer 0 for overload resolution and some error detection.)

Ehtyar

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,237
    • View Profile
    • Donate to Member
Re: C++0x: The Dawning of a New Standard
« Reply #5 on: August 22, 2008, 03:46 PM »
Dunno about regex being a core part of the language; it's useful, but you won't know about the speed of implementations if you're doing cross-platform stuff, so you're probably better suited using a thing like PCRE...
I imagine unless they actually use PCRE for their implementation, it will be too little too late.

Ehtyar.

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
    • View Profile
    • Donate to Member
Re: C++0x: The Dawning of a New Standard
« Reply #6 on: August 22, 2008, 03:48 PM »
Also C++0x will standardize shared_ptr<> which can make managing the lifetime of dynamically allocated objects pretty much as easy to manage as in garbage collected environments like .NET or Java.

shared_ptr's are seriously nice. 

shared_ptrs<> are already available as part of TR1 (which is now in MSVC 9/VS 2008  if you get SP1) or part of Boost.