AUG
18
2004

MS touts new C++/CLI standard calling it most powerful language for .NET

Just came across this article via msdn, C++: The Most Powerful Language for .NET Framework Programming. Microsoft seems especially pleased with their new version of Managed C++. They've done a complete revamp of their previous .NET support for C++ and submitted it to ECMA and ISO as a standard. This brings C++ inline with C# as far as first class support for the Common Language Runtime. I really like what they've done to improve the C++ experience for .NET, but still think it will be incredibly hard to adapt the Qt/KDE libraries to fit into this framework. Consider this annoyance, the new proposed standard mandates PascalCase be used for the core API. For a technical challenge you'd have to consider how to integrate MOC and the new C++.NET properties. Read on.



C++.NET properties:
property String^ Name
{
String^ get()
{
return m_value;
}
void set( String^ value )
{
m_value = value;
}
}

Q_PROPERTY:
Q_PROPERTY( QString name READ name WRITE setName )
void setName( QString name );
QString name() const;

Well, leave aside the technical challenge of making a Free Managed C++ compiler according to this new spec and check out what it offers:

  1. Object construction on the GC heap or regular native
  2. Value types and Reference types just like C#
  3. Boxing and UnBoxing so C++ gets a unified object model
  4. C# style delegates adapted for C++ in addition to normal function pointers

There is a handy reference table at the bottom of the article comparing C++.NET syntax for various operations and the equivalent C#. Check it out.