The New C++
发表于2002/3/26 9:56:00 581人阅读
The New C++
Copyright 2002 Herb Sutter
These are heady times for C++. Active standardization was put on hold after the C++ Standard was published in 1998, to give us time to fix bugs and let compilers and libraries catch up. Now things are "hot" again, and a lot of exciting stuff is happening.
This new column is about precisely that "exciting stuff." Titled "The New C++," it focuses on the active work now under way to extend the C++ language (not much) and library (very much) now and in the next few years as we progress toward "version 2.0" of the C++ Standard.
There's a lot to cover, and this is where you'll find the most up-to-date coverage. Some of us have already written a bit about the new C++ in other fora: for more overview information about where we're at and what (and why) exciting things are now happening, see the two complementary columns by me and Matt Austern in the January 2002 issue of CUJ [1, 2]. They contain some basic information about what's going on, who's going on about it, and — perhaps most importantly of all — how you can participate and how it affects your work today and in the short term, not just years down the road.
In this, the first installment of "The New C++," I am going to start with a complementary bird's-eye roadmap of where we've been and where we're going, and then I'm going to devote most of this introductory column to just that — introductions, of people and groups and terms, a "who's who" and "glossary" to the C++ standardization process. In future columns, I'll describe in more technical detail some of the key facilities being considered, how they work, and what issues come up as they're debated in committee and between meetings on the committee email reflectors.
Figure 1 shows the major pieces influencing the development of the C++ Standard, both in leading up to C++98's publication in 1998 and C++0x's publication at some future time. This picture should give you a useful roadmap of how various items work and connect, and what leads to what else at about what time. The rest of this column defines the terms used in Figure 1. And for now, I won't say much more than that, but I do hasten to point out one thing in particular: Boost is by no means the only, or even necessarily the major, outside contribution to the Library TR (Technical Report); it just happens to be the most visible single group at this time.
Here is a brief summary of the individuals and organizations who are the major players in the past and future C++ development process.
ANSI: The American National Standards Institute. At ANSI meetings, the rule is "one company (or individual representing themselves), one vote." Within ISO meetings, ANSI's delegation is the delegation for the United States and thus receives one vote, just as the delegations for other countries represented at the meeting each get one ISO vote. Still, because of the United States' predominant role in the software industry in general and in C and C++ in particular, ANSI is something of a "first among equals" in practice at WG14 and WG21 meetings.
ANSI J11: The ANSI C committee.
ANSI J16: The ANSI C++ committee. J16 always meets together simultaneously with ISO WG21 (this being one expression of its "first among equals" status). For the past two years it has also met at the same location, and in an adjacent week, as J11 so as to promote cross-committee communication.
AT&T: AT&T Bell Labs (now AT&T Research) is where C++ began life in the early 1980s, the brainchild of Bjarne Stroustrup. AT&T offered C++ for standardization and WG21/J16 work began in 1989/1990.
Boost: The "C+ Boost" effort was originated just after the C++98 Standard was passed in order to start working on developing "existing practice" for the next round of active standardization. Initially predominantly composed of standards committee members, the current membership has grown much wider. See <www.boost.org>.
CWG (Core Working Group): The "subcommittee" within WG21/J16 that focuses on core language issues, such as namespaces, templates, and so forth.
HP: Hewlett-Packard, where Alex Stepanov and Meng Lee invented the revolutionary STL (Standard Template Library), much of which was incorporated into the draft C++ Standard in 1995 and subsequently refined within WG21/J16.
EWG (Evolution Working Group): The newest "subcommittee" within WG21/J16, which first met in October 2001, that focuses specifically on directions for C++0x.
ISO: The International Organization for Standardization. ISO is not an acronym, however; it comes from the Latin word for "the same." At ISO meetings, the rule is "one country, one vote." (There is some discussion going on lately about changing this, but for now that's still the rule.)
ISO WG14: ISO C committee. Within the ISO organization, the technical working group responsible for C is JTC1/SC22/WG14, usually shortened to WG14.
ISO WG21: ISO C++ committee . Within the ISO organization, the technical working group responsible for C++ is JTC1/SC22/WG21, usually shortened to WG21. WG21 always meets together simultaneously with ANSI J16. For the past two years it has also met at the same location, and in an adjacent week, as WG14 so as to promote cross-committee communication.
LWG (Library Working Group): The "subcommittee" within WG21/J16 that focuses on standard library issues, such as containers, algorithms, streams, and so forth.
PWG (Performance Working Group): The "subcommittee" within WG21/J16 that focuses on the Performance Technical Report, which is not shown further here as it's not as directly concerned with C++ language and library features as experienced by users (compared to, say, Defect Reports and corrections in the TCs, and new features in C++0x).
Bjarne Stroustrup: The creator of C++ and author of its first compiler, Cfront. Stroustrup continues to be active in C++ standardization and currently chairs the fledgling C++0x EWG at WG21/J16 meetings.
Alex Stepanov: The principal creator of the STL adopted as a large part of the standard C++ library.
Besides the above persons and organizations, there are some other common names that deserve definition. They'll be bandied about regularly in this column:
ARM C++: C++ as of 1990. "The ARM" is an acronym for the book titled The Annotated C++ Reference Manual . The ARM was used as the base document to begin the C++ standardization effort.
C++98: The first official ISO/ANSI C++ Standard, published in 1998. Officially known as ISO/IEC IS 14882:1998(E).
C++0x: The second official ISO/ANSI C++ Standard, which is getting under way now and will be published in coming years (no date yet).
C99: The second official ISO/ANSI C Standard, published in 1999. This standard contains much that the C++ committee can be expected to adopt wholesale, or with minor modifications, as part of C++0x. After all, it's clear that the C++ committee values C compatibility, and the C committee has helped us by likewise valuing C++ compatibility, which has made some of C99's features easier to integrate into C++0x than they might otherwise have been. There are still some C99 features, however, that C++0x cannot easily adopt in their C99 form, because conflicting facilities already exist in C++98 (for example, complex is a class template in C++98 and a keyword in C99).
Library Extensions TR (Technical Report): Starting in 2001, WG21/J16 began actively soliciting and evaluating proposals for extensions to the C++98 Standard library. These are being collected for later publication in the form of a "Library Extensions" TR, which is officially non-normative, but don't kid yourself — as with the draft standard of C++ in the early and mid-1990s, vendors will be tracking this closely and implementing facilities as quickly as they can. Why? Because this TR, although non-normative in itself, is specifically intended to be added wholesale and verbatim into the coming-and-will-be-very-normative C++0x Standard.
STL: The groundbreaking STL developed by Alex Stepanov and Meng Lee at Hewlett-Packard Labs in the early 1990s. Most of the HP STL was adopted in 1995 and then refined to become the "containers, iterators, and algorithms" portion of the C++98 Standard library.
TCI (Technical Corrigendum 1): Completed in 2001, the first "mid-course correction" (a.k.a. "patch," a.k.a. "service pack," a.k.a. "maintenance release") to the C++98 Standard. Contains the resolutions to Defect Reports submitted by the global C++ community.
TC2 (Technical Corrigendum 2): As we continue working on the Library TR and C++0x, there will no doubt continue to be resolutions to still-pending and not-yet-received Defect Reports. Depending on the timing of C++0x, these may be issued in the form of a second TC.
Because of publishing lead times, even on the Web, I expect to finish writing two more installments of this column before the next C++ standards meeting in April 2002. Next time: a survey of the first batch of suggested library extensions considered at the October 2001 WG21/J16 meeting in Redmond, Washington, USA. The next time after that: a closer look at one of the proposed facilities. Stay tuned.
 Herb Sutter. "Sutter's Mill: Toward a Standard C++0x Library, Part 1," C/C++ Users Journal, January 2002.
 Matt Austern. "The Standard Librarian: And Now for Something Completely Different," C/C++ Users Journal, January 2002, <www.cuj.com/experts/2001/austern.htm>.
 The official WG21 website is at <http://std.dkuug.dk/jtc1/sc22/wg21/>.
 Margaret Ellis and Bjarne Stroustrup. The Annotated C++ Reference Manual (Addison-Wesley, 1989).
About the Author
Herb Sutter is an independent consultant and secretary of the ISO/ANSI C++ standards committee. He is also one of the instructors of The C++ Seminar (www.gotw.ca/cpp_seminar). Herb can be reached at email@example.com.