Most Read Latest News Blog Resources

C++ Revision Gathers Steam for ’09




July 15, 2007 — 
The C++ programming language has a rich history, but it’s been almost a decade since the last significant changes were made to it. At the risk of stating the obvious, a few things have happened in computing since November 1997, when the C++98 standard—ISO/IEC 14882 to be precise—was frozen.

But Working Group 21—the ISO/IEC C++ standards committee—hasn’t been idle, even though the only tweaks to C++ in the intervening years have come in the form of a 2003 technical corrigendum, a sort of patch release. In 2005, the workgroup published a draft of a report on desired extensions to the C++ standard library, Technical Report 1. TR1, as it’s known, is the first of at least two reports on the subject; much of the material in this first report will be incorporated into the next version of the C++ standard, referred to for now as C++0x.

The document updating C++ is due for ratification by the ISO member states in 2008, and upon introduction the next year, the new version will likely be referred to as C++09.

An overriding concern is to maintain compatibility with C++98, and wherever possible with C, making sure that “we don’t actually go and break code in large amounts,” noted C++ creator Bjarne Stroustrup. “We can’t just do the best in the abstract; it has to be the best for the community, both the implementers and the users.”

Another architecturally conservative decision is seen in the preference of using the standard library to add features, instead of bolting functionality onto the core language. At the same time, the C++ core isn’t carved in stone. According to Stroustrup, one of the purposes of this review is to remove errors and inconsistencies from the core.

Herb Sutter, convener of the C++0x working group, explained that among the main enhancements are support for concurrency and multithreading, and the addition of garbage collection. Also making his hot list are extensions to the standard library, including support for hash containers, regular expressions and smart pointers. Although many vendors ship support for these and other prestandard functions in their STL (Standard Template Library) packages, this upcoming release will mark their official move from the TR1 library to the official C++ standard library.

NEW ‘CONCEPTS’
Speaking of templates, both Stroustrup and Sutter agree that the new “concepts” feature may be just what developers have been looking for. This introduces a typing system for templates, meant to eliminate confusing error messages.

As Sutter explained, when using “STL algorithms that require iterators, if you pass it an integer instead, today you get reams of error messages. Now with concepts, you’ll simply get, ‘Hey, [12] is not an iterator,’ which is way more usable. That in one fell swoop solves 90 percent of the usability issues of templates, while retaining all of their power, and adds to that power as well. It lets you do some things like overloading that you couldn’t do with templates before.”

Stroustrup noted, “It’s actually quite tricky to get this to work, because templates and generic programming [have] become the major players in the high-performance [market], with high-performance computers, or close to [the] hardware on embedded systems. Performance is incredibly important. We can’t solve our problems by introducing more dynamic stuff.”

Performance is also a concern, noted both of the C++ pathfinders. Although C++ is already considered by some to be a high-performance language, Sutter observed that the improvements in C++0x have so far exceeded expectations.

The new R-value references, also known as “move construction/assignment” semantics, allow the use of disposable objects, and Sutter explained, “are a great technique for avoiding costs of copies automatically. That’s going to have a good effect on performance, even [with] existing applications, as move-semantics-enabled libraries, R-value reference-enabled libraries, become available and use that feature of the language,” he predicted.

Stroustrup and Sutter are both excited about the features designed to help developers take advantage of new multicore processors designs, including support for concurrency and multithreading and support for garbage collection. “Those are the other big-ticket items,” Sutter noted. “For concurrency, that doesn’t just include threads and locks, but also things like thread pools and futures, and also a world-class state-of-the-art memory model as well.”

Stroustrup explained, “Everybody uses threads. It may well be the worst possible way of using concurrency in a system, but everyone’s using them and they’re built into the system, so we must support that.”

“It’s parity, or in some cases, better than what Java currently has [or] what .NET currently has,” Sutter claimed. “Those three will be on a level playing field. People are already writing multithreaded code for C++ anyway, but because the standard doesn’t say anything about threads, it requires you to do system-specific stuff. So the main news here isn’t, ‘Hey, I can write multithreaded code in C++,’ [because] everybody does that today. The news is that I can write portable code that will run on all these different systems and compilers and has first-class concurrency support, equal to what you would find in other modern languages.”


Share this link: http://www.sdtimes.com/link/30940
 

Add comment


Name*
Email*  
Country     


  • Comment
  • Preview
Loading



 
 
 
 
News on Monday
more>>
SharePoint Tech Report
more>>


   

 
 
Download Current Issue
ISSUE 3/15/2010 PDF

Need Back Issues?
DOWNLOAD HERE

Receive the print Edition?


 
blogs tab
Google Code turns 5
Google Code Turns 5, and adds a Paxos Algorithm to make the system more stable and reliable.
03/17/2010 11:16 AM EST

Test your Visual Studio 2010 know-how
Microsoft is offering free beta certification exams for Visual Studio 2010.
03/17/2010 11:08 AM EST

Microsoft lifts the hood on IE9
Microsoft is previewing IE9.
03/16/2010 01:10 PM EST

 

Events calendar tab
3/22/2010 to 3/25/2010
Santa Clara, Calif.
The Eclipse Foundation

4/12/2010 to 4/14/2010
Las Vegas
Penton Media

4/12/2010 to 4/15/2010
Santa Clara, Calif.
O'Reilly Media

4/19/2010
New York City
Flagg Management

4/25/2010 to 4/28/2010
Overland Park, Kans.
IIUG