C++ Poised for Its Next Stages
LAS VEGASShaking off its staid reputation, the venerable C++ language is strutting its stuff here at the C++ Connections conference.
The evolution of the language can be seen in the plans for the next version, dubbed C++Ox, in the acceptance of new open-source code libraries, and the reception for certain enhancements to the language.
In many programming circles, the mention of C++ merits a big yawn. Its not that the language is retired, since some 38 percent of software developers use C++ at least part of the time, according to Evans Data, Inc. But its no longer perceived as cool.
Certainly, many developers think of C++ as static, dusty, unchanging.
But C++ has staying powerits 25 years old, this year, and has outlasted many other languages. It has done so largely "by being reasonably good at a lot of things," its inventor Bjarne Stroustrup said in his Tuesday keynote address. The programmer is now at Texas A&M University.
Thats a long way to travel for the language that Stroustrup originally envisioned as "C with Classes," which initially lacked virtual functions, templates and exceptions. Or for a language that, in its first commercial release, was given a marketing budget of $5,000 to last for three years. (They spent $3,000 of it on a single party.)
Among the reasons that C++ has had staying power is that the language wasnt superb at just one or two things, Stroustrup said. If it had been, it would have been excellent for one set of programmers and irrelevant to the rest.
He also credits a "firmness in general vision, and flexibility in all else," along with the willingness to listen to feedback from novices, experts and academia.
Humility, patience, and tolerance are important, he said, because "most of the time, youre wrong."
One large component to C++s success is its standard and the standards process. "Fortunately, the language didnt fragment and wasnt totally taken over by language vendors."
Yet, C++ isnt standing still. It never has. In the 1980s, Stroustrup pointed out, its major challenge was to take OOP (object-oriented programming) methodologies mainstream.
In the 1990s, generic C++ was the answer to the need to integrate mainstream programming techniqueswhich now included OOPwith functional techniques.
In this decade, Stroustrup said, we have to figure out "how to unify and combine these best practices and integrate them into the mainstream" with a "multiparadigm C++" (though, he promises, hell find a better name).
"It takes a lot to get changes done [to C++]," says Stroustrup. "But once theyre done, they stay."
What Comes Next
In a session this week, Matt Austern gave a technical report on the C++ Library Extensions TR1, the next version of the Standard Libraries.
Austern, the former chair of the C++ standards committees Library Working Group, was the principal implementer of the SGI standard library.
Austern explained changes in function libraries, built-in random number generators, and hash tables, which are now called "Unordered Associative Containers."
"That [wording] was mildly unfortunate, but it was necessary," Austern said, heading into some detail on the new regular expression model thats built into TR1.
As currently proposed, regular expression handling in the C++ libraries will be similar to the Python model. The syntax is based on ECMAscript; it includes many options such as alternate syntaxes. (A PDF of the TR1 proposal is available here.
The language update schedule is indeed a slow one. The cutoff for C++0x proposals has just passed. Proposals are due in October 2006 for TR2. The cutoff for the C++0x "cleanup" are due by April 2007.
"If you have ideas for new C++ libraries," Austern said, "Now would be a good time to submit them."
Not all proposed language changes were so well received.
In the beta version of Visual C++ 8.0, one well-known C++ expert reported, the use of a common
std::copy() call generates a warning that
std::copy() has been deprecated.
According to Danny Kalev, doing so is a violation of the C++ standards, because the word "deprecated" has a very specific meaning: dont use this feature, because it wont be in the next version of the standard.
std::copy() is not deprecated by the C++ standards committee; the warning message is a Microsoft extension to the language.
Author Kate Gregory explained that the code construct presents a security weakness in a programmers code. "You can turn off that error checking," Gregory said, "but you probably dont want to."
Language features and their code security are always debatable (especially when you get so many experts in one place). But in the last few weeks, the C++ standards group has had a lot of heated debate over Microsoft Corp.s language extension.
The real issue is Microsoft calling these changes deprecated when its a proprietary (however arguably useful) extension to their own compiler, not something endorsed by the standards committee.
In the end, though, Microsoft listened to the objections. Herb Sutter, a software architect at Microsoft and chairman of the ISO C++ standards committee, said Tuesday that Microsoft backed down. "We never intended to offend anybody. Weve already agreed to change it," he said.
Programming libraries keep developers from creating and debugging language components that, in many cases, others have already done better. Libraries help you define the world that your application lives in.
"In any bare language, programming is really quite unpleasant," said Stroustrup.
Check out eWEEK.coms for the latest news, reviews and analysis in Web services.