Wow. What a historic turning point this winter has turned out to be, as you'll discover in this column where I report on three Standards meetings:
- The October 2003 ISO/ANSI C Standards meeting. Usually I report just on C++, but as it turns out there is more and more C++-related news happening over in C of all places and it's not even a sign of the end of civilization. Far from it.
- The October 2003 ISO/ANSI C++ Standards meeting, held the week after the C meeting in the same hotel.
- The December 2003 ECMA C++/CLI Standards meeting. C++/CLI is the new kid on the block, recently created to standardize the greatly revised Managed Extensions for C++ programming on CLI (a subset of .NET). Its purpose is to ensure that C++ continues to be well represented as a first-class language for CLI/.NET development, and is standardizing a set of pure extensions to ISO C++ to support CLI features such as arbitrary garbage collection, generics (not the same as templates), properties, events, delegates, and other features, some of which overlap with C++0x evolution (for instance, delegating constructors, strongly typed enums). This was the first C++/CLI meeting, which is just getting started and is currently targeting completion in late 2004.
The C and C++ Standards meetings were hosted by Plum Hall in Kona, Hawaii, in October 2003. The ISO C and C++ committees meet twice a year, in the spring and fall, on consecutive weeks in the same location. For the past two years, I have been attending both C and C++. (Yes, that's a month per year out of my life. Please don't remind me.)
The first C++/CLI Standards meeting was hosted by Microsoft and Plum Hall in College Station, Texas, in December 2003. C++/CLI plans to meet a total of about seven times between December 2003 and September 2004 for two to three days each. (No, I don't even want to think about what fraction of my life that is, especially after you add in the travel days before and after each meeting.)
Here are the highlights of the meetings:
- Unprecedented C/C++ cooperation and convergence: Both the C and C++ committees are for the first time mutually adopting large parts of each other's work, and are even undertaking their first-ever shared work. This is only slightly short of astonishing, even to me as convener of the C++ committee, and it's wonderful news not only for people who use both C and C++, but also for Standard C and Standard C++ languages themselves, even though each has to make some modest sacrifices in the interest of gaining this greater convergence and compatibility.
- Language and library innovation and active convergence on several fronts: Within the C++ committee, the Library Technical Report is driving toward a close and the Evolution Working Group continues to pick up steam. In addition to the convergence between C++ and C, a subset of C++ committee members is also working on C++/CLI, a set of overlapping language extensions to support C++ well on the ISO CLI environment (a subset of .NET).
The C Meeting
The C committee is purposely stabilizing the C99 Standard in a holding pattern with no new active development underway on the language itself. That makes sense; as of this writing, there is exactly one fully conforming implementation of C99 on the planet (unsurprisingly, it's by Edison Design Group). Instead, the C committee is doing work in nonnormative Technical Reports (TRs). It has just finished up two such TRs, one on embedded systems extensions and another on character data-type extensions.
At this meeting, the C committee laid the groundwork to launch three new TRs. One of them is on C++ Standard Library security that is based on the past few years' work at Microsoft.
The other two TRs are directly related to C/C++ convergence:
- Adopting (some of) C++'s new library extensions. The C committee has created a second TR to serve basically as a placeholder while C waits for C++ to finish its Library Extensions TR, which happens to have a lot of C-like stuff in it, particularly for numerics work. C then plans to adopt verbatim the subset of C++'s new library additions that applies to C (for example, it doesn't mention templates or classes). Here, C is following C++, and it's no small news!
- Decimal arithmetic. Briefly, the C and C++ committees are actually going to work jointly on this decimal arithmetic work. This is precedent-setting . This TR marks the first-ever official collaboration between C and C++. IBM proposed and the C committee decided to begin work on C extensions to support decimal arithmetic as specified in the IEEE-754R Standard. What's the point? To better support commercial applications: It is possible, but difficult, to write logic in binary (base 2) arithmetic that correctly implements tax laws and other legal requirements that are specified in human-oriented decimal (base 10) arithmetic. The C committee adopted the work but felt that they should not do this without coordinating the extensions with C++ if possible, and so C recommended that the C++ committee also consider taking up this work. The following week, C++ agreed to take it up, too.
The C++ Meeting
Turning now to C++, first let me give some pointers to put this meeting in context. Here is a quick summary of the prior two C++ meetings and pointers to where you can find further information about them:
- October 2002 (Santa Cruz, CA), covered in my trip report in , is when the first two extensions were adopted for the Standard Library extensions technical report. These two extensions are tuple (covered in ) and function (covered in ; see also ).
- April 2003 (Oxford, UK), covered in my trip report in , is when no fewer than 10 more library extensions were added, notably type traits, regular expressions, smart pointers, random number generation, hash tables, and a huge set of math functions.
Now I'll focus on C++. The C++ committee has recently completed three major work items that have been ongoing for the past five years:
- The Technical Corrigendum ("service pack 1" to the Standard) was published in October 2003. Known officially as ISO 14882:2003(E), and colloquially as C++03, this is a corrected reprint of the Standard incorporating all of the corrections and fixes that were approved by the committee up to 2001. (Yes, it took two years to publish. But let's leave the topic of ISO's speed, or lack thereof, for later discussion over a beer.)
- The Performance Technical Report (Performance TR) will be published in 2004. This TR is focused primarily on hardware issues and embedded systems work, but also on C++ implementability and use (for example, how to implement and use exceptions for best performance). The Performance TR is now complete and pending one final pro forma ballot before it is published as an official TR. The C++ committee has requested ISO permission to make this TR publicly available, and we think that will be granted. In the meantime, you can already download recent drafts from the ISO WG21 committee's web site  for your reading pleasure.
- Defect Reports (DRs). Now that the work on Version 2.0 of the Standard (aka "C++0x") is in full swing, the work of processing potential errors and omissions in the existing Standard can be rolled into the more general C++0x refinement and evolution process.
That leaves three major active work items, two of them preexisting going into this meeting, and one adopted at this meeting:
- Library Technical Report (Library TR). ETA late 2004 or early 2005. The Library TR is a vehicle to add new functionality to the Standard Library in advance of C++0x itself, and the current best estimate is that it should be technically complete after two or three more meetings, which means Fall 2004 or Spring 2005. It is limited to considering only those additions that don't require any extensions to the core language; examples include smart pointers, hashed containers, generalized function pointers, and other cool stuff. This TR is intended to feed more or less directly into C++0x, but will be completed much sooner so that we can continue to gain real-world experience with these library features in advance of standardization (always a good thing). Today, working implementations of most parts are available via Boost , and Standard Library implementers have already started work to create their own implementations of all or part of it. Bottom line: The facilities in this TR are serious, real, and en route to your desktop. I've previously covered several of them already and will continue to cover more.
- Evolution WG: C++0x ETA 2007 or later. The C++ Evolution Working Group is considering additional items not covered by the Library TR because they would involve core language changes. The EWG's goal at this meeting was to consider a batch of concrete proposals, but not to accept any yet at this meeting.
- Decimal Arithmetic Technical Report (Decimal TR: New). The C++ committee is about to begin a new TR on decimal arithmetic, coordinated with the C committee. This is great news and the first-ever direct collaboration between the two groups.
Note the division of work between the Library TR and the Evolution WG: The former deals with library-only extensions that do not require additional language support, and the latter deals with proposals that require language extensions to do well. Some items may be accepted into the Library TR as "hackaround" extensions that work around today's C++ language limitations. If and when the EWG closes those holes with better language extensions, the library hackarounds can be refined or abandoned.
Here are the highlights of what happened at this meeting.
C++ Library TR: Nearing Completion and Adopting the C99 Library Wholesale
At the previous two meetings (Santa Cruz and Oxford), the first 12 library extensions were approved for the Library TR.
- N1548, A Proposal to Add a Fixed Size Array Wrapper to the Standard Library Technical Report.
- N1550, New Iterator Concepts.
- N1530, Iterator Facade and Adaptor.
Perhaps most notably, the group agreed in principle to adopt wholesale all of the new facilities that were added in the C99 Standard Library, thereby resynchronizing the C++ Standard Library with the most current C Standard Library. C++ has historically been based on C89, and so didn't have snprintf and other functions that are new in C99. Until now. P.J. Plauger will be bringing an updated paper to the next meeting (Sydney), which is expected to adopt it.
With the aforementioned, the library working group is now closing the door on additional proposals for this TR, and plans to spend the next two or three meetings to refine this content into publishable form. New proposals are still welcome, but will be queued up for a possible second Library TR or for C++0x itself.
C++ Evolution Working Group
The C++ Evolution Working Group (EWG) is still early into the C++0x work and continues to make steady progress. Many proposals were discussed and will be further refined, including support for concept checking for templates. Two particular proposals that were well received that bear on collaboration with other standards bodies are:
- nullptr. I presented a proposal coauthored by Bjarne Stroustrup and myself on nullptr, an explicit null pointer constant. This is a feature that came directly from the C++/CLI work and directly overlaps with ISO C++ evolution, so everyone wanted to be sure to check with the EWG to minimize the potential for divergence of similar features in C++/CLI and ISO C++ itself. The proposal was well received, and the main change request was to specify the name of the type of nullptr.
- Desire to adopt C99 preprocessor extensions. The EWG started considering a proposal to adopt C99's variadic macro extensions, and by the end of the discussion had overwhelmingly endorsed in principle the idea of airlifting all of C99's preprocessor extensions straight into C++0x, including but not limited to just the variadic macros. This is a big deal that horrifies some people (who'd rather see macros die) and greatly encourages others (who get warm fuzzy feelings from all this concrete convergence between C and C++).
The C++/CLI Meeting
The final standards process that was just getting started at the time of this ISO C++ meeting was ECMA C++/CLI.
My main day job for the past year and some has been to lead the design team at Microsoft that is revising (well, completely overhauling) the Managed Extensions to C++ for .NET (CLI) programming. ECMA C++/CLI is standardizing those revised extensions. They make developing for the CLI/.NET platform in C++ a first-class experience, just as easy as in Those Other Languages you may have heard about that might sometimes claim to be the Last Word on that platform.
Needless to say, it's essential that this C++/CLI work exist and be elegant and usable, so that C++ is ensured first-class representation on important platforms. It's also essential that this work be true to ISO C++ that is, not only true to the existing C++ Standard, but also that it not impede ISO C++0x evolution that is now underway and will stay underway for the next few years. There's one major reason for confidence that all of this will happen and that C++/CLI will do the right thing: The C++/CLI work is being done by a subset of the ISO C++ committee with a healthy (complete) respect for both of today's ISO C++ and ISO C++0x now under construction.
The attendees at the first C++/CLI meeting were: Dinkumware (P.J. and Tana Plauger), Edison Design Group (Steve Adamczyk and John Spicer), IBM (Sean Perry), Microsoft (myself, Brandon Bray, Rex Jaeschke, and Mark Hall, who was the principal designer of the original Managed Extensions), Plum Hall (Tom Plum), Bjarne Stroustrup, and Gabriel Dos Reis. In addition, we also had Jan van den Beld, ECMA's secretary-general, to lend a much-appreciated helping hand with information and advice.
This first meeting was mainly organizational, and organize it did: The C++/CLI and C++ committees have now set up official e-mail and in-person collaboration, in addition to their already broadly overlapping membership. Over the coming months, we will continue to work closely with C++/CLI and C++ to ensure compatibility and craft high-quality support for C++ on important modern platforms, including garbage collection, reflection, serialization, and all the other bells and whistles that are part of CLI.
C and C++ are actually actively converging and adopting each other's work. C++ and C++/CLI are actively collaborating to respect C++ evolution and craft high-quality C++ language extensions that will help to ensure C++'s continued relevance, nay supremacy, on important platforms.
What's this cooperation and collaboration busting out everywhere? Was there something in the Kona water? Won't the sudden euphoria wear off? Is there no fly in the idyllic ointment anywhere to be found, no chill in the summery breeze of happy harmony? Nope, there are no flies or chills at the moment, and it's a welcome breath of fresh air that will benefit C and C++ programmers on all platforms as C, C++, and even their extensions begin and continue to actively converge.
Yes, what a historic turning point this winter has turned out to be.
 Sutter, H. "Trip Report: October 2002" (C/C++ Users Journal, 21(2), February 2003). Available online at http://www.cuj.com/documents/cujcexp2102sutter/.
 Sutter, H. "Tuples" (C/C++ Users Journal, 21(6), June 2003). Available online at http://www.cuj.com/documents/cujcexp2106sutter/.
 Sutter, H. "Generalized Function Pointers" (C/C++ Users Journal, 21(8), August 2003). Available online at http://www.cuj.com/documents/cujcexp0308sutter/.
 Sutter, H. "Generalizing Observer" (C/C++ Users Journal, 21(9), September 2003). Available online at http://www.cuj.com/documents/cujexp0309sutter/.
 Sutter, H. "Trip Report: April 2003" (C/C++ Users Journal, 21(10), October 2003). Available online at http://www.cuj.com/documents/cujexp0310sutter/.
 There is a little more administrative detail than that, because oddly enough ISO actually has no formal process for two committees like C and C++ to actually work together like this. Go figure! So John Benito (the C convener) and I (the C++ convener) are setting up a structure whereby we'll be effectively working together anyway, so there, effectively working around and cutting through the ISO red tape. At the end of the process, C and C++ will issue its own Decimal Arithmetic TR, and the two will be identical except only for hopefully a small number (if any) of C- and C++-specific parts.
Herb Sutter (http://www.gotw.ca/) is convener of the ISO C++ Standards committee, author of Exceptional C++ and More Exceptional C++, and is a Visual C++ architect for Microsoft.