Programming 版 (精华区)
发信人: zhangyan (TestDriving...), 信区: Programming
标 题: The New C++: Trip Report, Oct 2002
发信站: 哈工大紫丁香 (2003年01月04日13:40:24 星期六), 站内信件
www.cuj.com/experts/2102/sutter.htm
The New C++: Trip Report, October 2002
Herb Sutter
-------------------------------------------------------------------------------
-
Copyright ? 2002 Herb Sutter
I'm going to spend this column reporting on happenings at and around the most
recent C++ Standards meeting, because things are now heating up, at least a
little. In particular, the first two proposals for C++ Standard library
extensions have now been accepted by the committee — and it's something of a
breakthrough, in that this represents the first new work to be accepted since
the first round of standardization was completed in 1997!
First, a Word from Our Technical Corrigendum
Since 1998, the C++ Standards committee has spent most of its time processing
queries and potential minor bug fixes to the existing Standard. In my
writing, I've sometimes referred to a few of the more notable bug fixes; for
example, in Item 7 of More Exceptional C++ [1], I mentioned that we were
adding the requirement that a std::vector's internal storage be contiguous,
so that a programmer can take a pointer to some element inside a vector and
safely do pointer arithmetic to traverse the vector's contained elements just
like an array. I've also mentioned that the first batch of these are being
published as Technical Corrigendum 1 (a.k.a. "TC1"; think of it as "service
pack 1") to the C++ Standard.
Some astute readers, including Daniel Spangenberg, have asked why they can't
seem to find an official copy of this much-vaunted TC1. I blush — the
unfortunate truth is that sometimes ISO wheels grind exceedingly slowly.
Although the first batch of corrections was approved by the committee back in
October of 2000 (yes, really two years ago), it took another couple of
meetings before the final text could be prepared and carefully proofread, and
the TC document only just went out for ISO balloting in November 2002 and
that final international voting will conclude in mid-February of 2003. We
don't expect any surprises; if so, then the TC will be official around the
time you read this.
In the meantime, I'd like to remind everyone of some long-standing good news:
you don't have to wait for ISO to issue new documents to stay up to date on
the committee's work (and you can be sure that your compiler vendor doesn't
wait that long). You can always get an up-to-date list of all issues and
their status right from the ISO C++ committee's website at
<http://std.dkuug.dk/jtc1/sc22/wg21/>. Again, that's "all" issues, not just
the ones resolved in TC1.
If and when you do peruse the issues via the ISO C++ website, be sure to
check both the Core and Library issues lists, because language and library
issues are tracked separately. There are three major categories of issues:
Defect Reports are things that the committee agrees need to be fixed
(anything from typos to unclear wording to actual errors) along with the
appropriate corrections to the Standard that fix them.
Active Issues are issues under active consideration. These include brand-new
issues that have been received since the last meeting, as well as issues that
have been discussed at prior meetings, but for which the committee still
needs to invest further thought or work before committing to a specific
resolution.
Closed Issues are issues that have been handled without need for further
action. Some of these are readers' requests for clarification or
interpretation, which can be (and is) given without needing any change to the
Standard. Others are interesting items, but outside the realm of "bug fixes" —
for example, we explicitly decided not to consider extension requests during
the first few years after the Standard was produced — and have been tagged
for "future" consideration in the next standard, C++0x. (Those are now
beginning to be considered, now that it's open season on actual extensions;
see below.)
News from the Front
Here's a quick update on the C++ committee's goings-on at the most recent
meeting. For a more complete backgrounder on the current C++ Standards
process, published exactly a year ago and still pretty current, see [2],
which is my initial "The New C++" column.
The C++ Standards committee (ISO WG21, ANSI J16) met in Santa Cruz from
October 20-25, 2002. The C++ committee is currently busy with the following
major pieces of work:
Issues and Defect Reports (DRs). The committee continues to spend about half
its time answering queries about the existing Standard, issuing
clarifications, and fixing bugs (including typos and small inconsistencies).
There have been several new fixes approved since TC1 was finalized; it
remains to be seen whether there will be a second interim Technical
Corrigendum, or whether the updates will just be rolled straight into the
next major revision of the Standard, C++0x.
Evolution Working Group (EWG). The C++ Evolution Working Group is now
actively considering extensions for the next full revision of the C++
Standard. The EWG is normally chaired by Bjarne Stroustrup, but as he
couldn't attend this meeting I chaired it in his absence. (I think Bjarne has
only missed about four meetings in the decade-plus history of C++
standardization; it doesn't happen often, and he continues to be very active
in C++ Standards work.) What kinds of things does the EWG consider? Well,
library-related issues, such as new containers and things like tuples, are
already being considered as part of the Library TR noted below. But the
Library TR cannot consider extensions to the core C++ language itself, and
this is where the EWG comes in as the first filter to consider new proposals
to extend the C++ language.
The Evolution group's goal at this meeting was to consider the initial batch
of concrete proposals, and to offer the authors guidance on which ones we
were interested in and how to refine them. We considered about a dozen
proposals, ranging from my typedef templates paper to Bjarne Stroustrup's
typeof proposal, from compile-time assertions to move constructors, and the
authors have the feedback they need to go back and refine their proposals for
further consideration at the next meeting. (I think the next meeting promises
to be interesting — just as we had the very first new library extensions
since 1997 approved at this meeting (see below), we might just get the very
first new language extensions since 1997 approved at the next meeting in
April 2003. Time will tell; watch this space for updates.)
Library Technical Report (TR). Well, we're actually working on two Technical
Reports, but the Library TR in particular is the most noteworthy one because
it's definitely intended for direct inclusion the next C++ Standard, a.k.a.
C++0x [3]. While the Evolution WG concentrates on refinements to the core
language, the Library TR is all about adding new functionality to the
standard library; the original intent was to get a head start on the next
round of standardization, which is expected to include aggressive additions
to the standard library.
If the Evolution WG is now reviewing proposals, why continue with a separate
Library TR? Because people hope the Library TR can be finalized sooner (say,
perhaps in two years) than we could finalize a review-ready draft of the
whole next C++0x Standard.
At this meeting, the big Library TR news was that the first two library
extensions were approved for the Library TR! In brief, they are:
Doug Gregor's proposal for polymorphic function object wrappers [4].
Jaakko J?rvi's proposal for tuple types [5].
That's why I say that things are heating up, at least a little — after
several years of maintenance-only mode and about a year of talking about
extensions, these are finally the first two extensions to the C++ Standard
library to be actually accepted by the committee since the first standard was
finalized in 1997. They are certainly a harbinger of many more to come, as we
considered well over a dozen library and language extension proposals at this
meeting.
Are you wondering what these two new extensions are all about? If so, then
keep reading this column — in the next two installments, I'll cover each of
these two accepted library extensions in detail. Then I'll be writing the
column after that just in time to report on the next C++ meeting, to be held
in Oxford in early April of 2003, where it's likely that the first new C++
language (not just library!) extensions will be presented for vote by the
committee. Stay tuned.
References
[1] H. Sutter. More Exceptional C++ (Addison-Wesley, 2002).
[2] H. Sutter. "The New C++," C/C++ Users Journal, February 2002.
[3] The other one is the Performance TR, which is focused primarily on
hardware issues, embedded systems work, and C++ implementability (e.g., how
to implement and use exceptions for best performance). The Performance TR is
currently in balloting and should be published in early 2003.
[4] D. Gregor. "A Proposal to Add a Polymorphic Function Object Wrapper to
the Standard Library," ISO/ANSI C++ standards committee paper (ISO/IEC
JTC1/SC22/WG21 paper N1402, ANSI/NCITS J16 paper 02-0060).
[5] J. J?rvi. "Proposal for Adding Tuple Types into the Standard Library,"
ISO/ANSI C++ standards committee paper (ISO/IEC JTC1/SC22/WG21 paper N1403,
ANSI/NCITS J16 paper 02-0061).
Herb Sutter (<www.gotw.ca>) is convener of the ISO C++ standards committee,
author of the acclaimed books Exceptional C++ and More Exceptional C++, and
one of the instructors of The C++ Seminar (<www.gotw.ca/cpp_seminar>). In
addition to his independent writing and consulting, he is also C++ community
liaison for Microsoft.
--
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.239.188]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:212.091毫秒