Within the MicrosoftDotNet environment both CsharpLanguage and CeePlusPlus are offered, the latter has With Managed Extensions added to the product name since mid 2003.
For comparison between the two, see http://groups.google.com/groups?th=bb6a628756b1703d where the second entry of the thread show some impressive capabilities of the latter, namely in ItJustWorks, which is very important in ComInterOp that serves as a bridging technology between ComponentObjectModel and DotNet.
Advantages of CeeSharp:
- Shorter build times than C++. With CPP, even with modern computers, you wait and wait for the compiler to compile 100 000 lines of code generated by the preprocess for a hello world with #include "windows.h" in it.
- Ever hear of PrecompiledHeaders??
- Yet if I compiled a hello world with #include "anythingElse.h" it's fine, perhaps the blame is on deciding to include every function definition for every task in one header file that must be included just to get a pushbutton.
- Cross platform, able to deploy on different architectures. (Mono for Linux/Mac, .NET for Windows)
- Please clarify. It's usually the libraries that are at issue, not the root language.
- [C/C++ itself contains implementation dependencies. The size of a C# int, for example, is signed 32 bits. In C/C++ it's sizeof(int), which varies depending on implementation.]
- {Mono is only a partial implementation. It's implemented the common stuff, but some of the more esoteric items aren't done.}
- Safe exception handling, every "crash" can be safely handled, where C++ just burns to the ground when something goes wrong.
- {Heh. Don't they just wish.}
- Large runtime, making otherwise hundred lines of code into a single line on more than one occasion.
- Windows GUI design is a lot easier than in C++ (MFC/ATL, yuck...)
- Fairly fast, but not as fast as C++, in general. (some algorithms are better implemented in C# than C++, like the square root function which seems to be faster)
Advantages of CeePlusPlus:
- ResourceAcquisitionIsInitialization idiom - enables implicit and deterministic resource management for memory AND other system resources (files, windows, locks...).
- Possibility of usage of processor intrinsics. (SSE/SSE2/MMX)
- Inline assembly
- {Not really a part of c++.}
- Better optimizable; working on native code gives you exactly the instructions that are executed, instead of an intermediate language, making it more comprehendable, and easier to optimize (with IL you can't do a damn thing about the assembly that is generated).
- Not dependent on a 150 MB runtime (this is in fact my biggest gripe with anything .NET related; why can't they just link in parts from the runtime into the EXE? Same goes for Java)
- No garbage collector (why is this an advantage? if you want really fast code with no memory overhead at all, you will just use a pool of memory, and never have to think about memory allocation/deallocation again. There are several more reasons, all related to speed and predictability. And if you really do want a garbage collector because you're too lazy to write proper cleanup code, just use some random c++ garbage collector on the web anyways, or for that matter, C++/CLR)
- Lightweight standard library with a limited set of the most used primitives (vector, set, map, list, hash_map on some implementations..)
Something that people don't seem to realize about C++ is that you can implement a lot these fancy language features from other languages in C++. For example, people complain about having to deal with memory management...not only does STL get rid of the need for allocating memory in many cases, garbage collectors have been written for C++. The response I usually get to that point is that "that requires additional upfront programming." Well, yes. *Someone* has to do the programming (just like *someone* did the programming to get a particular feature into a language). Does it have to be you? No, most of the features people want have already been implemented (ever hear of sourceforge?).
Anyway, I realize that there doesn't exist a language that is good for every job. My point is that C++ is flexible enough and strong enough to achieve most of those jobs with relative ease (and even more ease once it's been done once).
- And yet, when I nail those ExtraLegsOntoaDog, it still barks.
- You probably just need a few more rivets in the beak.
Can we get a list of things one can do in C++, but not in C#, and the other way around?
If you mean tasks, then no. Both are TuringComplete. The question is not what can be done, but what is simpler for a given programmer in a given language. Maybe a list of how primary language features compare to each other is what you want?
Here's a quick list:
- Events: CeeSharp has a first-class-citizen approach to type-safe events, and the events can have multiple listeners. (PublisherSubscriber? model)
- Templates: CeeSharp 2.0 has Generics, which look a lot like templates with some extra type-safety (parameter X must be constructable, parameter Y implements virtual-base IThisInterface, etc). MicroSoft CeePlusPlus DotNet does both CeePlusPlus Templates *and* Generics, which must cause some confusion.
- ObjectOriented: Although CeePlusPlus supports the ObjectOrientedParadigm?, you don't have to use it. Everything in CeeSharp is an object.
-
JamesWilkinson
See LanguagePissingMatch
CategoryProgrammingLanguageComparisons, CategoryCeeSharp, CategoryCpp