ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

C++0x: The Dawning of a New Standard

(1/2) > >>

Ehtyar:
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.

mouser:
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).

Ehtyar:
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:
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...

mwb1100:
I wonder why nullptr is necessary, '0' is clean enough in source code? (but perhaps this is template-magic related).
-f0dder (August 22, 2008, 08:21 AM)
--- End quote ---

Regular old overloading and plain old readability.

I like nullptr.  The rationale from the nullptr proposal (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/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.)

Navigation

[0] Message Index

[#] Next page

Go to full version