C++ for free
Every once in a while Microsoft pops a new goodie out to the MSDN Web site
with more or less fanfare. Last week it was the Microsoft Visual C++
Toolkit 2003. This free download includes:
- The same optimizing C++ compiler and linker that are a part of Visual Studio
- The C Runtime Library, C++ Standard Library, and Standard Template
- The Microsoft .NET Framework Common Language Runtime.
- Sample code.
In other words, you get everything you need to build C++ applications,
whether they target the Win32 API or the Common Language Runtime, as well as an
optimizing compiler to make them faster.
Of course, Microsoft has been shipping a free C++ compiler for a couple of years now, as part of the .NET Framework Software Development Kit, which is also a free download. And from time to time preview versions of the compiler have shown up in the Platform SDK. But this is the
first time that they've released their current, cutting edge, optimized compiler for free,
without crippling the features in any way. One has to wonder why they've chosen
to do this.
It's fun to speculate on Microsoft's reasons for giving this software away
(but do recognize that this is only speculation, and not informed by any inside
information). The most popular argument is probably the "hearts and minds"
theory. The idea is that you give away a compiler to get developers sucked into
writing code with that compiler, so that you can then lock them into your tool
set. The problem with this theory is that there's really not a shortage of free
C++ compilers for Windows. You can download the MinGW set of tools for free, to name one
alternative, and merrily build all of the Windows applications you like. What
that means is that lock-in is pretty tough; if you start using Microsoft's
compiler, it should be no big deal to move to MinGW if there's something that
bothers you about Microsoft or its tools in the future.
Of course, one twist to the argument is that Microsoft can in fact get you
locked in by delivering a superior compiler. And there's a lot to like about
this particular compiler, including its high level of ANSI/ISO conformance. Most
of the information on the Top
10 Reasons to Upgrade to Visual C++ .NET 2003 page apply equally well to the
Visual C++ Toolkit. But now the conspiracy theory loses some of its bite; it's
like saying that your boss is conspiring against you when he gives you a
raise, because that makes it more likely you'll stay with the company.
Another idea that gets advanced by the anyone-but-Microsoft set is that
giving away the command-line compiler is a ploy to upsell you into the IDE, for
which you still have to spend money. That argument, too, is somewhat less than
convincing. With the variety of IDEs (a good number of them free), build tools,
testing tools, and so on out there, it's perfectly possible to put together a
C++ build process that won't cost you a dime. I'm not aware of a good free
visual form designer, but other than that you can cover all the bases. And of
course forms can be designed non-visually; until recently, that was the only way
to do it anyhow.
When you get done trying to attribute sinister motives to Microsoft, I think
the explanation here is relatively simple: the platform is the business (or at
least a darned good chunk of it). Honestly, it doesn't much matter how many
developers are using Visual C++ in the grander Microsoft scheme of things. What
matters is how many are building good applications for Windows. Releasing a
high-quality compiler into the wild for free strikes me as a sensible way to
raise the overall quality of Windows applications, and I certainly am not going
to complain about that.
Mike Gunderloy has been developing software for a quarter-century now, and writing about it for nearly as long. He walked away from a .NET development career in 2006 and has been a happy Rails user ever since. Mike blogs at A Fresh Cup.