Cook Computing

VS.NET 2003 C++ Enhancements

February 5, 2003 Written by Charles Cook

Richard Grimes has a worthwhile article in MSDN magazine about some of the new C++ features in VS.NET 2003(via Sam Gentile).

Its interesting to note that the compiler now allows you to generate verifiable assemblies, but by the time you have taken into account all the restrictions on the C++ code - for example you cannot use __nogc types - you are essentially left with a C++ "skin" for C# rather than C++ in all its power and glory. I was slightly puzzled by the claim that you can use platform invoke: surely this would prevent an assembly being verifiable?

Although I've never felt that MC++ should have much of a long-term future - we must get away (for most purposes) from developing in languages which are not type-safe and which do not have garbage collection - its great for making the transition to a managed environment. For example, I've been experimenting with using NUnit to test unmanaged library code. The unit tests are implemented in test fixtures implemented as__gc classes with MC++. The unmanaged code is simply linked to the test assembly and, as they say, It Just Works. The assembly can then be run in NUnit which extracts details of the tests to be run via reflecting on the attributed C++ test code:

using namespace System;
using namespace NUnit::Framework;
namespace LibTest
  public __gc class TestTypeLibCache
    void ServiceLocatorMethods();