CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Jun 2006
    Posts
    16

    C++/CLI and Managed C++

    Whats the difference between C++/CLI and Managed C++?

  2. #2
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: C++/CLI and Managed C++

    Syntax mainly - however C++/CLI it is a standard (I believe) whereas Managed C++ is not.

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++/CLI and Managed C++

    Yes, it is a standard under ECMA (European Computer Manufactures Association) since late autumn 2005. Microsoft is currently looking for standardization under ISO.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Nov 2003
    Posts
    1,405

    Re: C++/CLI and Managed C++

    Quote Originally Posted by cilu
    Yes, it is a standard under ECMA (European Computer Manufactures Association) since late autumn 2005. Microsoft is currently looking for standardization under ISO.
    In which way is it a standard? I mean C++ is standardized already. Does CLI add syntax to C++ which makes C++/CLI a dialect that's no longer compatible with standard C++?

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++/CLI and Managed C++

    No. C++/CLI is a different language, based on C++, but providing support for the CLI.

    I wrote an introductory article to C++/CLI here. It would be good to read it, especially if you have some .NET familiarity.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  6. #6
    Join Date
    Nov 2003
    Posts
    1,405

    Re: C++/CLI and Managed C++

    Quote Originally Posted by cilu
    No. C++/CLI is a different language, based on C++, but providing support for the CLI.
    It looks like a bastardisation of C++. Who would ever want to use that? Are people expected to program in it directly or is it some kind of intermediate language used in automatic translations?

    Please don't tell me Visual C++ .NET programming using managed code in fact means using C++/CLI?
    Last edited by _uj; July 6th, 2006 at 01:31 PM.

  7. #7
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++/CLI and Managed C++

    Well, "VC++.NET" name was a mistake from Microsoft, because it can lead to confusion. As a result, it with the release of Visual Studio 2005, the .NET part was removed from the name.

    In VisualC++ from Visual Studio 7.0 and 7.1 you can write C++ programs (aka native applcations or MC++ programs (aka managed application). MC++ stands for Managed Extensions to C++.

    In VisualC++ from Visual Studio 8.0, the MC++ langage was replaced with a new and better one called C++/CLI. However, compatibility to the former MC++ language is assured (by using a compilation switch). Again you have the two coinces, building native or managed applications, as well as mixed-mode applications.

    C++/CLI is not a bastardization of C++. And if you want to leverage the power of the .NET framework, you have to use a managed language, and if you are a C++ programmer, you may rather want to use C++/CLI than C# or VB.NET.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  8. #8
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: C++/CLI and Managed C++

    Code:
    It looks like a bastardisation of C++. Who would ever want to use that? Are people expected to program in it directly or is it some kind of intermediate language used in automatic translations?
    I have said, and will continue to say, that the language of choice for .NET programming is C#.

    However (as in fact I have been doing over the last 4 months) there are reasons for using C++.NET or C++/CLI.

    I must say that the C++/CLI extensions are far more intuitive than their predecessors (the inclusion of a foreach statement is very welcome).

    However you must bear in mind that native C++ and C++/CLI are two completely seperate languages.

    Native C++ compiles down to native code, on whichever platform you are working on.

    Managed C++ or C++/CLI compiles to IL code which is JITted (and if you don't know what this is look it up on google).

    These are two completely seperate paradigms, one being the evolution of the other.

    To say that one "bastardises" the other is completely wrong. Each have their place in modern programming, and each should be used according to their advantages and disadvantages.

    But, when in doubt use C#. And use interop to interact with native C++ code (in the form of dlls, be it static Win32 dlls or COM dlls).

    That's my preferred route of doing things.

    Darwen.
    Last edited by darwen; July 6th, 2006 at 04:38 PM.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

  9. #9
    Join Date
    Nov 2003
    Posts
    1,405

    Re: C++/CLI and Managed C++

    However you must bear in mind that native C++ and C++/CLI are two completely seperate languages

    To say that one "bastardises" the other is completely wrong. Each have their place in modern programming, and each should be used according to their advantages and disadvantages.
    If C++ and C++/CLI are completely different languages then you must admit that the name of the latter is a misnomer. If you develop a new language that isn't C++ then at least you should have the decency to call it something that doesn't give the impression it is C++.

    To me C++/CLI, regardless of its technical merits, seems like an attempt to lean on the credibility of C++ and to motivate that the "C++" letter combination still can be used in the Visual C++ product name.

    But, when in doubt use C#. And use interop to interact with native C++ code (in the form of dlls, be it static Win32 dlls or COM dlls).

    That's my preferred route of doing things.
    Well if C++/CLI really isn't C++ and if C# is equally efficient in every possible way then why not prefer it. Is there a downside of using C# over C++/CLI?
    Last edited by _uj; July 7th, 2006 at 03:24 AM.

  10. #10
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++/CLI and Managed C++

    If C++ and C++/CLI are completely different languages then you must admit that the name of the latter is a misnomer. If you develop a new language that isn't C++ then at least you should have the decency to call it something that doesn't give the impression it is C++.
    I suppose and your father have the same surname. Are you the same person? Or do you think you two should have both first and last name differ to be two different persons? Do you understand where I'm going?

    C++ is built based on C. Most of the things in C are present in C++ (some of them with changes, like the structs). But C++ and C are not the same language, because C++ has a lot of additions.

    C++/CLI is built based on C++. EVerything from C++ is present in C++/CLI. But C++ and C++/CLI are not the same language, because C++/CLI offers extensions for the CLI.

    To answer the last question, Microsoft now considers C++/CLI the most powerful language targeting the CLI.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  11. #11
    Join Date
    Nov 2003
    Posts
    1,405

    Re: C++/CLI and Managed C++

    Quote Originally Posted by cilu
    C++/CLI is built based on C++. EVerything from C++ is present in C++/CLI. But C++ and C++/CLI are not the same language, because C++/CLI offers extensions for the CLI.
    So C++/CLI is a superset of C++? Well that improves the situation somewhat.

    http://msdn.microsoft.com/msdnmag/is...C/default.aspx

    Although I'm not the only one who's reacted negatively to the name,

    http://www.research.att.com/~bs/uk-objections.pdf


    To answer the last question, Microsoft now considers C++/CLI the most powerful language targeting the CLI.
    Have they said why? I'd guess to call unmanaged C++ wouldn't be any faster than doing it from C#.
    Last edited by _uj; July 7th, 2006 at 06:20 AM.

  12. #12
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++/CLI and Managed C++

    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  13. #13
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: C++/CLI and Managed C++

    Additionally, you should read Stanley Lippman's MSDN Magazine Articles.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  14. #14
    Join Date
    Nov 2003
    Posts
    1,405

    Re: C++/CLI and Managed C++

    Quote Originally Posted by cilu
    I referred to an "objections" link in my previous post. They warned for the possible confusion between the C++ and C++/CLI languages.

    Interestingly the title of the article you recommend is an argument in case. You get the impression that C++ is the most powerful .NET language. It's not, C++/CLI is, a totally different language.

    I'll never buy it. C++/CLI is fool's gold. If I'm going to use .NET it's going to be C#.

    Read the "objections" document. Here it is again,

    http://www.research.att.com/~bs/uk-objections.pdf
    Last edited by _uj; July 7th, 2006 at 02:32 PM.

  15. #15
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: C++/CLI and Managed C++

    I will have to say I've just spent 4 months writing an application in Managed C++, and boy was it hard work.

    I know that C++/CLI is easier - the inclusion of a foreach statement is possibly the greatest improvement, but I believe (and Cilu will correct me if I'm wrong) you still have to do dynamic_cast etc and it's just so much easier in C#.

    I think that instead of the code taking 4 months to write if I was able to use C# it'd probably have taken 1 month. As well as have been easier to read.

    I'm not a fan of either managed C++ or C++/CLI, mainly because I find the number of keystrokes necessary to get something done is significantly greater than in C#.

    Actually I find it funny that Microsoft have changed their views like this - C# was and still is the first .NET language and is designed from the ground up to be a .NET language. C++/CLI is still an extension of C++, no matter what anyone says, and is confusing if you don't know exactly what you're doing.

    It is probably faster than C# (because of whole program optimisations etc) but I'd be surprised that it was significantly faster. Again Cilu could correct me on this.

    However the ease of use of C# as opposed to both the .NET C++ derivitive languages far outweights any speed improvement in my opinion.

    I still say use C# with native written in C++ dlls.

    I've always found C# a lovely language to deal with. Both managed C++ and C++/CLI just seem like banging my head against a brick wall in comparison.

    My personal opinion of course, so please no flames....

    Darwen.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured