Saturday, May 9, 2009

What's the different between these C++/CLI , C++ , C# and what's the best?

The real answer for the main part of that question is probably "it's up to you."





C was invented at Bell Labs in the early 70's (started in 69). The design initially was based on the "B" programming language which has since died. It was initially developed on/for Unix systems but it obviously turned out way more valuable and advanced from there.





C++ is "Object Oriented C." Essentially, there's extra language constructs and implicit background stuff to make it object oriented. It's still pretty much always used to compile raw native CPU bytecode. So when you have "int a = 5;" the compiler will still compile that into the cpu instruction to assign 5 into a register (and possibly other things so that it all fits or to prepare for upcoming calls, enhancing performance). This is why Microsoft distinguishes "native code" from "managed code"





In the case of both C++/CLI that native code is wrapped like crazy in MetaData and Library code so it can be accessed by other languages. So a call like that might do a lot more on lower levels. In other words, the performance of this one is inferior to the native C++. But there's definitely a tradeoff. The point of managed code is convenience. It is quite easy to write applications in C++/CLI relative to native C++. And more complex facets of things like memory management and such are automated. So it makes it less error prone.





C# just another language entirely that looks like (I'm not sure if it really is) a combination of Java and C++. Like java, it's quite simple to write in. An advantage over Java is that it uses better methods of garbage collection and implements native code (it can because it's not marketed to create cross-platform binaries). So while slower than native C++, it is much faster than Java. But the tradeoff is then your binaries will only work on Windows. But then again, none of these three languages provide cross-platform binaries.





In all managed code, you get a very large library of predefined functionality that in native C++, you would have to manually write or search for and download whlie worrying about licensing. Pretty much any everyday coding can be done using the .NET CLR builtin API without any of these kinds of concerns.





C++/CLI and C# would theoretically have no performance differences. I haven't tested, but if there are, it's not because of the technology itself (like in Java). It would more likely be just because the MS C# compiler has had less life and thus less fine-tuning.





...





In summary, C++ is what is better if you are looking for speed and at least a little (and it is only a little as opposed to none) portability. If you want to pop out your application fast, C++/CLI or C# is the way to go. C# is actually probably easier to code with while C++/CLI is a good intermediate between native C++ and C#. I personally am of the speed-demon result types, so prefer native C++. But in business, the "pop-it-out-quick" type is probably more useful.

What's the different between these C++/CLI , C++ , C# and what's the best?
c* is the best
Reply:C was the original. C++ wasa later version. not sure about C++/CLI, but C# is the most recent incarnation of the C language. It is used for making web based applications.


No comments:

Post a Comment