Editor's Forum


The Best of Both?

I believe it was late 1996 or early 1997 that I attended a very interesting “Birds of a Feather” meeting at Software Development Conference on the merits of Java vs. C++. The Java hype machine was still in its early adolescence and growing apace, of course, and this particular discussion was clearly dominated by Java aficionados extolling the safety and productivity gains of the newest Hot Language. The party line in those days (and still today, I suppose) was that Java didn’t let you hang yourself with errant pointers and memory leaks. The classic comeback was that Java programs were not and would never be near as fast as C++ executables, and real programmers know how to use pointers responsibly anyway, thank you very much. Nowadays C++ programmers would also be quick to point out the power of templates as a design tool without peer.

The debate has cooled somewhat, as has the hype. Java is findingits niche, and C++ seems as entrenched as ever. Both languages seem to be co-existing peacefully as they go their separate but useful ways. A comment made in that meeting, however, has stuck with me all these years. One eloquent young Java evangelist remarked that if a large third-party industry has established itself around finding pointer violations in C and C++ programs, maybe something really is wrong. Having myself routinely used such tools [1] to good advantage, I had to admit he had a point. But was the solution to yield myself to a particular vendor’s language platform while losing run-time efficiency in the process? In 1997, I thought, “No dice,” but with a few years of Java under my belt, I have found that there are times when a JVM does just what I want.

With the introduction of Managed C++, the gap between these two popular languages is narrowing. What is Managed C++? The incomplete, knee-jerk answer is, “Managed C++ is a way to use (most of) Standard C++ safely in a garbage-collected environment.” The CLR (Common Language Runtime) solves pointer problems in pretty much the same way the JVM does, except you have a larger palette of languages to choose from. The only environment that supports Managed C++ today is Microsoft’s .NET under Windows, but there are reasons to hope that will change. We also have it on Good Authority that Microsoft has now decided to take the C++ Standard seriously, so you can probably expect the next release of Visual C++ .NET to take your exception specifications and template-template parameters seriously. And allegedly, you get all of this with better performance than with the best of JVMs (emphasis on allegedly).

In this issue and its accompanying supplement, we explore both the Talk and the Walk of .NET and Managed C++. With one of the largest C/C++ code bases in existence, you will find that Microsoft is motivated to make the transition to Managed C++ an attractive and relatively painless one, if not by altruism, then at least by self-preservation.

Note

[1] Such as Rational’s Purify and Numega’s Bounds Checker.

Chuck Allison
Senior Editor
cda@freshsources.com