Slashdot Mirror


Stan Lippman On Version 2 Of Managed C++

Lansdowne writes "Stan Lippman, one of the founding fathers of C++ and currently a language architect at Microsoft, has prepared an exhaustive translation guide, comparing old Managed C++ to the revised CLI/.NET version of C++. According to Lippman, "There are a number of significant weaknesses in the original language design (Version 1), which we feel are corrected in the revised language design (Version 2).""

1 of 40 comments (clear)

  1. Re:I don't understand by Foolhardy · · Score: 5, Insightful
    Maybe because "Managed C++" and "ISO C++" are two entirely different languages? Sure, they may have some syntax in common, but they have almost nothing in terms of purpose, design philosiphy or capibilities in common.

    Managed C++ has less features than ISO C++, namely templates and multiple inheritance.

    You cannot mix code from the two in many ways, like having a class from one inherit from another.

    Sizeof of managed classes is impossible. Managed classes cannot use const or volaitle.

    Managed objects cannot be passed by value; only references or value types. (ISO C++ objects are structs that can always be passed by value)

    Operator delete doesn't work if no user-defined destructor exists in a managed object.

    Managed classes cannot override operator& or operator new.

    A managed object cannot be used as a member in a union.

    Managed c++ does not use unions; instead a complicated field offset system.

    Pointers to objects cannot always be casted in managed C++, pointers of the same size can always be casted in ISO C++.

    Data in managed C++ is zero-initialized. Data in ISO C++ has arbitrary values unless explicitly initialized.

    Managed C++ adds certain members to all classes (as derived from Object), like GetType; all classes derive from System::Object. ISO C++ classes can have no parent class.

    Static sized arrays are illegal in .net

    C-style multiple parameters are not supported; use param array instead

    Normal c++ supports static-only typing. Managed c++ requires dynamic typing, at least to some extent.

    Pointers to members are not supported in any way in managed c++; delegates replace them.

    Normal C++ makes absolutely no library requirements on outputted code; not even the startup library is necessary. Managed c++ requries the entire .net runtime, and requries you to include mscorlib.

    Classes cannot be defined inside of functions in managed C++.

    Any class can be derived from in normal C++. Sealed classes cannot be derived from in managed C++.

    Conversion functions are always static in managed c++. The naming convention is different.

    RTTI is not supported in managed c++.

    Only public inheritance is supported in managed c++.

    Normal c++ explicitly has no garbage collector as part of the language; if you want one, use a library. Managed c++ requires you to use .net's GC.

    The layout of members in a class or struct in normal c++ can always be known at runtime. Managed makes them permanently opaque.

    Removing anything from C++, espescially something as important as templates or multiple inheritance, makes managed C++ a distinctly different language. And this is just a list of some of the things that normal c++ has that managed doesn't. The list of extensions is much longer.