C/C++ Users Journal February 2004

Editor's Forum

Nearly two years ago, Andy Koening gave an interesting talk at the Oxford C++ Standards meeting. He speculated pretty freely about the directions in which C++ should evolve if it is to remain a vibrant, or at least relevant, programming language in the coming years. He was unaware, at the time, that many of his ideas were already being actively pursued by a major compiler vendor. That vendor happens to be Microsoft Corporation, and the new dialect is called Managed C++. It's designed to be both a first-class citizen in Microsoft's .NET ("dot net") environment and a good citizen in the world of Standard C++.

First, a little background. Java is Sun's attempt at a portable and safe execution environment. The Java language itself is just another member of the C family of programming languages. Where the portability and safety come from is the Java Virtual Machine (JVM), an interpreted execution environment with lots of checking. A Java compiler outputs machine language, also known as "bytecodes," for this JVM. To execute Java on an arbitrary platform, all you need is a JVM interpreter ported to it to read the bytecodes and do what they say (with checking, of course).

Microsoft abandoned its own ambitious plans for Java after a nasty dispute with Sun that I won't go into here. (It has yet to be completely settled.) Microsoft's eventual response was to trot out its own C dialect, called C# ("C sharp"), and its own virtual machine, called the Common Language Interface (CLI). But here's where the paths begin to diverge. Where the JVM is highly tailored for one language—Java—the CLI is designed as a reasonable machine language for a number of languages. And where the JVM is designed to host Java on multiple platforms, the CLI still has only one full-fledged environment—Microsoft Windows.

Now, CLI may indeed be intended to host multiple programming languages, but some languages are more at home there than others. The "managed" environment, as the CLI is called, favors garbage-collected objects and checkable pointer operations. C# is pretty clearly intended as the flagship language, a point not lost on the C and C++ adherents at Microsoft. To stay in the game, they had to hustle, several years ago, to provide extensions that let you talk about objects that could be garbage collected and shared with all those other programming languages. The result wasn't always pretty, but it achieved its goal.

Now the C++ folks are getting more ambitious. They don't want to just stay in the game; they want C++ to be the language of choice for writing all sorts of code, managed and otherwise. That means a serious overhaul of the original clunky extensions. It also means a careful rethinking of the whole architecture of C++ in a managed environment. And, since Microsoft has finally gotten religious about programming language standards, it means a careful balancing of the needs of Standard C++ conformance with readability of its own Managed C++ dialect.

The folks at Microsoft have made some clever moves. They hired Herb Sutter, now Convener of the ISO C++ Standards committee WG21, to serve as a principal architect. They solicit ongoing advice from Bjarne Stroustrup, inventor and still active developer of C++. They also get much useful guidance from the guys at Edison Design Group, whose knowledge of C++ parsing and translation is nonpareil. And they even ask Dinkumware an occasional question or two.

Microsoft has also made some savvy political moves. Perhaps the biggest was to submit first CLI and then C# for standardization by an independent body. It chose the European Computer Manufacturers Corporation (ECMA) for this process. ECMA has an excellent track record for producing commercially meaningful standards in remarkably short periods of time. Moreover, ISO accepts ECMA standards for fast-track approval, a vote of confidence that the ECMA process is sufficiently open. (It doesn't hurt that Sun could never quite bring itself to cede control of Java in the same way. In fact, Java is a rare failure among the hundreds of projects undertaken by ECMA.)

Now Managed C++ is starting down the same path. I recently attended the first meeting of ECMA TC39/TG5 in College Station, Texas. (That's where Stroustrup now resides, on the faculty of Texas A&M.) Between courses of barbecued beef and Texas wine (sic), we began the process of refining a dialect of C++ that can take advantage of the CLI without doing violence to Standard C++. The goal is to have a completed document for ECMA approval before the end of 2004. That means a lot of meetings in a short period of time, but some of us feel the payoff can be well worth the effort. I hope I still feel that way after 10 months of jet lag.

P.J. Plauger
Senior Contributing Editor
pjp@plauger.com