Sunday, October 03, 2004

Whidbey C++ - Easier than C# in a number of areas

I've got a few C++ sessions and columns coming up over the next couple of months for Microsoft Australia and as part of a new C++ column I'm doing for Developer.com, and have used this as motivation to begin to really understand where C++ is going in Whidbey. Like everyone else (or so it seems), I am no fan of Managed C++, and had to give it up when my underscore key broke due to overuse. All the C/C++ I have done over the past couple of years has been getting code bases to the point where they could be called with P/Invoke or COM interop from pure managed applications. While I think I got to the stage where I understood Managed C++ well enough to program in it, I had zero confidence that any Managed C++ I produced would be maintainable by the folks I left behind when my engagement with an organisation was done.


Anyway, enough Managed C++ bashing. The new C++ language extensions coming in Visual C++ 2005 are really good. While they resemble C# more than Managed C++, they are a long way from a poor-mans C#, and actually makes some programming tasks a lot easier than C#. The two primary benefits are deterministic clean-up of disposable objects that are logically located on the stack (via the injection of a using statement by the compiler), and the ability to declare trivial properties in a single line (eg. property string Name;). While this seems like a minor feature, it cuts down on the amount of pasted get and sets that end up in a method, and is something that C# really lacks. I asked Anders about this features at the MVP conference last April, and got an unenthusiastic response.


If you are coming from a Visual C++ 6.0 perspective, the language looks really clean and immediately understandable. Given the great interop capabilities of C++, and the fact that it will be a really first-class experience for developing .NET applications, I'd expect to see most of those still in the 6.0 product moving into Visual C++.NET (even if they stick to native code) with this release.

0 Comments:

Post a Comment

<< Home