Partager via


News of my death has been greatly exagerated

Good morning!

I really meant to write earlier. I've been busy preparing
for a trip to the Netherlands, where I am right now. I'll talk about that
tomorrow.

Anyways, I promised I'd talk about what I heard from C++
developers at PDC. After so many years of customer concern that Microsoft didn't
care about Microsoft, it was great to see how excited people were to know that
C++ has a vibrant future. Of course there was the introduction of the new
language design, but the message that I think was best received was that
rewriting applications to take advantage of WinFX is unnecessary and almost
always the wrong approach. Many people didn't know that existing C++ code can
run on top of the CLR without any modification.

That's right, you heard me. The CLR is rich enough to
express all of the C++ semantics. In Visual C++ 7.0, we introduced the /clr
switch. As a home experiment, just try it – take any program, compile it with
/clr, and chances are really high that it will just work. That is where the
acronym IJW (it just works) came from. I was surprised at how many people didn't
know about this. We're officially calling this feature (at least for now) C++
interop.

Of course, the great thing is that in Visual C++ "Whidbey",
this feature is improving. How can something that is named "It Just Works" be
improved? Well, for starters we can improve on some of the performance issues.
Undoubtedly, anyone who ran the experiment above would have taken notice of a
noticeable slowdown. In Whidbey, we've done several things to address this. Two
of them are the __clrcall calling convention, which allows a program to avoid
the top performance culprit "double thunking", and the /clr:pure switch which
also avoids double thunking, but enables some CLR features that did not work
with C++. Double thunking is an interesting topic, and I'll write about it
later.

Another way that "Whidbey" improves the IJW feature is that
we're doing a lot of the ground work in the libraries to take existing programs
and let them use the Frameworks. The best example is we're enabling MFC programs
to use WinForms. Naturally, much of the work will allow MFC to make use of other
Frameworks APIs too. That means all the MFC programs out there can start using
WinFX without ripping and replacing their current code.

Another thing I heard from PDC is that running on
down-level platforms that do not have WinFX is crucial. This is similar to
versioning the Win32 API. It was possible for programs to test whether the
operating system had a particular API, and then change behavior based on the
results. This was done with delay loading a DLL and using GetProcAddress. In the
WinFX world, it changes. We're currently working on creating the best practice
for doing this. It is sufficient to say that this will be possible.

Many customers asked how Microsoft applications are going
to take advantage of WinFX. Naturally, quite a few developers like to see how
Microsoft does something first. Just as many customers are looking into WinFX,
so are all the applications around Microsoft. Existing C++ applications (that's
pretty much everything Microsoft currently ships) are using Visual C++ to take
advantage of WinFX. A few places where other languages make sense, other
languages are being used. Another feature that Visual C++ "Whidbey" introduces
is MSIL linking, which allows anyone to take a .netmodule generated by any other
language, and link it into a C++ program as if the .netmodule were just another
object file.

I also got asked, "What is it like to work with Herb
Sutter?" Of course, Herb is great person to work with, and certainly brings
another point of view to discussions. I barely knew I was working with
celebrity. J It was too bad the
Southern California fires prevented Herb from showing up at PDC. At the same
time, Herb was at the C++ Standard WG21 meeting. Quite a few things are going on
there, but we also took a chance to let everyone else on WG21 know what was
going on with ECMA and the new language features that bind C++ to the CLI.

Another celebrity I was asked about is Stan Lippman. People
definitely missed him at the PDC. I completely forgot to mention Stan in my last
posting. Stan definitely has provided a number of contributions to the new
language design. As I get to discussing individual language elements in more
depth, I'll certainly show where Stan deserves much of the credit. Right now
Stan, one of the projects Stan is working on is a translation tool from the
managed extensions syntax to the new C++ syntax. In fact, Stan has the best
expertise in this area. Sooner or later, he too will have a blog. I'll mention
when that happens.

In the end, the one message I heard from customers was
"thank you". There are a lot of C++ developers out there who are very excited
about what Visual C++ "Whidbey" will deliver. I heard comments to the effect of
"Visual C++ is back" and "C++ is on its way to being the top language again."
We're very excited to see customers excited about Visual C++. C++ is definitely
the most enabling language I have ever worked with, and we can't wait to see
what C++ developers are going to do with WinFX.

Comments