Thinking Parallel

A Blog on Parallel Programming and Concurrency by Michael Suess

C++ vs. C# – a Checklist from a C++ Programmers Point of View

The NetI realize for most of you this is probably old news. I have been taking a first look at C# a little while ago, because I wanted to know if it is worth looking into, and because I am thinking about polishing up my class on Parallel Programming here at the university with a little language diversification. I have taught it using POSIX Threads before, but since everyone and their grandmother seems to use Java or C# these days, throwing in a couple of examples in these languages won’t hurt. And besides, I was curious ;). Without having written a single line of code and just by reading the various guides available, I have come up with a list of differences between C# and C++ and thought you might enjoy reading it here.

And so, without any further ado and very brief, here is my list of differences between the two, sorted into three categories: things I like better in C#, things I like better in C++ and things where I could not make up my mind. The last subheading lists the resources on the net used to compile that list:

Pro C#:

  • garbage collection
  • array bounds checking
  • huge .NET-Framework library
  • types have a defined size (e.g. a long is 64Bit)
  • strings are encoded in UTF/16
  • autoboxing – every type can be treated as if it inherits from object
  • supports constructor-chaining (one constructor can call another constructor from the same class)
  • when a virtual method is called in a constructor, the method in the most derived class is used
  • static constructors (run before the first instance of the class is created)
  • exceptions have access to a stack trace
  • advanced runtime type information and reflection
  • supports variadic functions nicely
  • built-in support for threads
  • no need for header files and #includes
  • no fall-through on switch-statements
  • arithmetic operations can be checked for overflow if required
  • objects must have a definite value before being used
  • attributes can be attached to classes and retrieved at runtime
  • no forward declarations required, classes can be arranged at will
  • access to class members / functions is done only by the dot (no more -> or ::)
  • conditional functions (e.g. for debugging)
  • structs and classes are actually different (structs are value types, have no default constructor in general cannot be derived from)
  • supports properties
  • readonly members are const, but can be changed in the constructor
  • finally block for exceptions
  • arrays are objects
  • support for anonymous functions
  • supports the base keyword for calling the overridden base class

Pro C++

  • better performance
  • portability
  • multiple inheritance
  • deterministic destruction (allows RAII)
  • any type can be thrown as exception (only classes derived from System.Exception in C#)
  • ability to enforce const-correctness
  • implicit interfaces on generics (in C#, generics must be constrained with an interface)
  • offers pointers (C# only offers pointers in unsafe mode)
  • support for macros
  • support for global variables, functions, constants
  • allows default arguments on function parameters
  • STL
  • supports bitfields

Where C# is just different from C++

  • value types and reference types exist (struct is value-type, class is reference-type)
  • value types live on the stack, reference types on the heap
  • references can point to null (must not be valid)
  • code is packaged in assemblies in C#
  • no automatic conversion from int to bool in C#
  • main-function is called Main in C#
  • no semicolon after a class declaration in C#
  • everything derives from object or can be treated as if

Resources

Disclaimer

As you can clearly see, this is not really comprehensive. The single bullet point huge .NET-Framework library would probably fill a page at least as big as this, if it was well presented. Some categorizations may also be controversial, e.g. I see portability as a huge plus for C++, while others might not care at all (or point me to Mono). Performance is also a point where I am not so sure. I expect all the nice features of C# to bring a performance-penalty into the equation, yet if you really see this in a real-world program is an entirely different matter. But since this is by no means a comprehensive treatment of the matter anyways, you are going to have to live with it – or if you can’t, you know how to use that comment button! :P

Coming to the end of this article, I have a small request: I am looking for a good book on C# development to recommend to my students (and read myself, must not forget that :P), preferably one that is for people with a background in C/C++ and with content on threaded programming (because that’s what the class is all about). Browsing the reviews on the net, it appears that Programming C# is pretty good, judging from the table of contents it also covers threads, but of course I don’t know how well. Do you have any other recommendations? Or can you comment on whether the book would be suited for my purpose? Your comments are (as always) very appreciated!

148 Responses to C++ vs. C# – a Checklist from a C++ Programmers Point of View »»


Comments

  1. Comment by Larry O'Brien | 2007/03/06 at 21:02:36

    I wonder if you’d consider C++/CLI as something that has many of the advantages of both C# and C++.

    Anyhow, for C# tutorials with serious threading discussions, I can say with certainty that there is no book that will satisfy you. For a general tutorial, I generally recommend Liberty. For your interests and experience, I don’t hesitate to recommend Richter’s “CLR via C#” and Hejlsberg’s “C# Programming Language” (as the reference).

  2. Comment by CaffèNero | 2007/03/06 at 22:22:26

    - “abstract classes can contain code – interfaces in C# cannot”

    …err… C# has abstract classes, too. Interfaces are just…. Interfaces. And, for good OO-programming’s sake, they should NEVER contain code. So, I’d move this one to the “Pro C#” category, reformulated as:
    “C# has interfaces, C++ doesn’t”

    - “any type can be thrown as exception (only classes derived from System.Exception in C#)”

    Forgive me, but I can’t see the problem. Again, in an OO world any exception should inherit from a base class. If you need to add custom information to an exception, just make your own exception class.

    - “C++ offers pointers”

    ….Which, again, should NEVER exist in any modern language. I agree that for low-level tricks pointers may be useful, but otherwise… stick with references.

    I could go on, but I don’t want to be pedantic… (MACROS? No, seriously… :) )

    My point is that C# has its shortcomings, but you shouldn’t overlook the major semantic cleanup which it represents compared to C++. And it has Events! ;)

    Ciao,

    Alessandro

  3. Comment by Michael Suess | 2007/03/06 at 23:50:14

    Larry: I have not looked into C++/CLI more closely, but will do so shortly. Thanks for the book recommendations.

    Alessandro: thanks for the tip on abstract classes, I have taken that point out of the article. Please also note that this is a strict feature comparison, I have not said anything about how useful these features are. But of course, your input on their acutal usefulness in practice is appreciated…

  4. Comment by Kristof Gajsek | 2007/03/07 at 09:16:12

    I’d suggest “Inside C#” (Tom Archer, Andrew Whitechapel) and “Introducing Microsoft .NET” (David S. Platt). Both include chapters on multithreading.

    As far as multithreading is concerned, I think Pro C# is the ThreadPool class and lock statement, which in most cases simplify development of multithreaded code.

    Some categorizations, as you say, may be controversial. “Huge .NET library” is a big plus when you develop a server side solution, where you control the environment. When you develop a cliend side solution, this may end up as “huge additional download and install” for users, so may be placed in “Pro C++” category. :-) Also, you can not develop system stuff and device drivers in .NET.

    If I extend Alessandro: C# has its shortcomings, but if you can live with them, it sure makes your life much easier than C++. A C++/CLI may be a good merge of both worlds.

  5. SaD
    Comment by SaD | 2007/03/13 at 21:56:42

    - multiple inheritance
    You really need in multiple inheritance? I think multiple inheritance only confused when you work on big project.

    - support for global variables, functions, constants
    Global for project? Becouse C++ not clear object orieneted language. Global variables, functions, constants in C# – you can declare in main class as static.

  6. Comment by Graeme Bradbury | 2007/03/26 at 16:08:28

    The Book “Pro C# 2005 and the .NET 2.0 Platform” from Apress is a very good all round c# book.

    “CLR via C#” by Jeffery Richter is an excellent book for people who want to know how .Net under the covers works.

    There is also a free ebook on threading in C# at: http://www.albahari.com/threading/

  7. Comment by Michael Suess | 2007/04/02 at 20:46:04

    Graeme: thanks for the tip, especially the last link looks really useful. And if a Nutshell-book about .Net 3.0 is on the way (as implied by the last link), this will definitely be useful as well.

  8. Comment by Henrik Feldt | 2007/04/20 at 20:22:13

    Don’t forget the niceties that comes from being able to use the language in the common language routine! You can import visual basic assemblies, J# assemblies, PHP assemblies,
    Boo assemblies (boo.codehaus.org), Nemerle a. (http://en.wikipedia.org/wiki/Nemerle) et cetera. :)

  9. Comment by Peter Ibbotson | 2007/04/29 at 15:44:31

    Another vote for CLR via C# by Jeffery Richter possibly the most used book I have on .net.

  10. Leo
    Comment by Leo | 2007/05/05 at 16:24:10

    I learnt my .NET from Andrew Troelsen’s book on .NET 1.0 – *highly recommended*. Now there is a .NET 2.0 version available (Third Edition) and a .NET 3.0/3.5 scheduled for this year. Large books and can be intimidating at first, but easy to read once you get started. Troelsen covers most of what one needs to write code. Richter’s book is a natural follow up. More depth, less surface area.
    http://www.amazon.com/Pro-2005-NET-Platform-Third/dp/1590594193/ref=pd_bbs_sr_2/103-4941246-7143836?ie=UTF8&s=books&qid=1178374547&sr=8-2

    Regards,
    Leo

  11. foo
    Comment by foo | 2007/07/27 at 23:28:21

    Regarding C#, how is “objects must have a definite value before being used” a pro?

  12. Comment by Michael Suess | 2007/07/28 at 00:09:33

    @foo: everything that helps to prevent errors is a pro for me. And using uninitialized objects is an error I see in students code frequently – an error that would be caught by the compiler if they were using C#…

  13. Comment by Anjuna Moon | 2007/11/06 at 13:38:50

    Hm, almost half of your “positives” on the C++ list are actually the negatives that promoted the development of C#. As a veteran C++ developer I can see where you are coming from, but you shouldn’t post views on something you haven’t grasped.

    Let’s go through some of your misconceptions:

    - Better performance : What do you base this upon? C# and C++ are both just high-level programming languages. Performance is dependant on how the compilers interpret andr translate your code and nothing else.

    - Multiple inheritance && pointers: These are two of the most important differences in my opinion. MI was nothing but a root of so many problems in a multi-developer environment. The same I can say about explicit pointers. By developing the interface and delegate-features in C# these problems have decreased a lot.
    Bottom-line in the MI-issue is – if you can’t design a model using only interface-implementation and single-inheritance then you simply aren’t fit to design it.

    - Support for macros: I tend to agree a bit, but you should look into attributes of .Net to see that there is a whole lot you actually can do to interact with the compiler. Of course this applies to C++.net as well, but now I guess we are leaving the .Net part out of the discussion.

    - It is interesting to see that you give a plus to both C# garbage collection as well as the old deterministic destruction of objects. I would like to see why this ambivalence exists. If you use C++ eg. for game-programming, sure – then a lot of your points are true, especially on the det.destruction-point.
    But since you are comparing C++ to C# we are not talking about these kind of applications and therefore there is nothing that promotes your old memory-leaking problems that even the most experienced developer creates in old C++ vs. managed garbage collection.

    - Support for globals: What kind of “global” are you missing in C#? If you haven’t grasped the namespace-system then you should study some more. In a true object-oriented model there is need for only one global – the root class. If you don’t know how to develop without using “free” globals, then you should study even further ;)

    - Supports bitfields: True enough that the language itself doesn’t support this, but again we are not discussing applications where pure mapping to machine-code is essential (if we were discussing that we wouldn’t even talk about C#). However, since C# is mainly used in the .Net environment, this is not a problem since .Net offers the same bit-array-handling you have natively in C++ and a lot more manipulation-possibilities that are not there in C++. Thus, no negative.

    - STL: You have got to be kidding me or you really have no idea of the extensiveness of the .Net-library. Nuff said on that! Jeez…

    - Portability: This remains the argument in the Java-world, but the the fact is this is not (and has not been for a long time) an issue in corporate reality. The only major shift between platforms done on a global scale the last two decades have been from old Cobol-systems to either (or both) Unix/Linux and Windows.
    What an intelligent and cost-effective enterprise today does is to utilize the power of a platform and thus using the environment best suited for this purpose. Neither Java nor C++ classic can do this, just because of the platform-independentness that many of there libraries are built upon. Therefor they are actually far weaker choices as environments.

    - any type can be thrown as exception (only classes derived from System.Exception in C#): Not sure what your getting at here so please expand that. You can catch all exceptions in try-blocks, even from unmanaged components, so what is your point?

    - ability to enforce const-correctness: Dear old discussion in the C++ community but i tend to agree with Anders Hejlsberg on this subject and do not see this as a major downer.

    Well, in conclusion – C++ is naturally the given choice in real-time or close to real-time application-development, but when comparing it to C# we are mainly in the .net-world: In this environment there is in my mind no comparison and C# comes out the winner.

  14. Comment by Michael Suess | 2007/11/11 at 22:17:04

    Anjuna Moon: Thanks for sharing your thoughts here. You raise some very valid points. Unfortunately, you have chosen to spice up your points with personal attacks, which does not help your credibility at all, in my humble opinion.

    You have also misunderstood the point of the post: I have listed all the differences I could find. Yes, that means some of them are contradictory. It is not a list of things I like or don’t like about these languages. As I have posted at the very beginning of the article, I don’t even know enough about .NET to judge that.

  15. Comment by steve | 2007/12/12 at 07:26:34

    This comparison and discussion is interesting for both the content
    and the opinions of the participants. The thought that a language
    like C# can be as efficient as C++ is false. The statement C++ can
    be as efficient as C# is true. Features such as garbage collection
    are not free – I’m sorry to say. Its also interesting to see how
    some see a sortcoming (or just a decision not to support a feature)
    as a benefit. Now that’s some great spin. I’ve used multiple
    inheritence a bunch in the past and the noone ever complained.
    Sure, I can make all of my classes derive from the exception class
    so that I can throw them. No problem. But to spin this as an
    advantage is comical.

    The question I would ask is this: if MSFT hadn’t depricated all of its
    C++ libraries in favor of C#, would there be as much of it out there
    today?

    My answer would be no…

  16. Comment by programmer | 2008/01/21 at 16:40:44

    “when a virtual method is called in a constructor, the method in the most derived class is used” – *very* dangerous behaviour, c++ is better in that aspect

    “value types live on the stack, reference types on the heap” – it depends on compiler optimizations, in c++ you have the same possiblity

    “deterministic destruction (allows RAII)” – you can use that in C#

    In my opinion you should lern little more about programming.

  17. Comment by Dragontamer | 2008/03/30 at 02:50:59

    I don’t really know C# and I appreciate the list… but I do know C++ and would like to make a few comments if you don’t mind.

    * garbage collection

    C++ has 3rd party garbage collection, and in all flavors too. You can get a reference counting GC or use a Mark and Sweep one or whatever other algorithms are out there. They work pretty well and override the global operator “new” function. Check out Stroustrup’s FAQs for pointers on this part. http://www.research.att.com/~bs/bs_faq.html#garbage-collection

    * array bounds checking

    Just pointing out that you can use std::vector.at() and you’ll get bounds checking. I find it hard to think of situations when I’d use an array over a std::vector.

    * built-in support for threads

    A valid complaint, just noting that C++0x will hopefully rectify that situation :-) (Stroustrup says “C++0x will almost certainly include a threads library.” in his FAQ).

    * no fall-through on switch-statements
    * arithmetic operations can be checked for overflow if required

    These sound pretty awesome. I’ll have to look into C# just for these feature alone.

    * objects must have a definite value before being used

    I’m somewhat confused by what you mean about this. If you don’t provide a default constructor in C++, you are forced to initialize every object, or else you get a compile time error. Perhaps you mean primitives must have definite values?

  18. Comment by JAngo 6 | 2008/06/23 at 10:33:44

    This Discussion has been a GREAT help.
    I hope more teachers as well as NOOB’s would come across this site.
    Wonderful contribution.

  19. Comment by Rhonald Moses | 2008/06/23 at 12:41:51

    Hi,

    In my humble opinion, as I use both C# and C++; it’s all about what you are planning to do and how much confident are you in handling what you do.

    I don’t see much negatives in C++ as some lazy and careless coders see here. I find Multiple inheritance feature and pointers as awesome. I have hardly had the problems that are mentioned above. A half breed programmer is always half breed despite the tool he use.

    A programming language is a mere tool that helps you create what you want.

    C++ is all about endless power at developers disposal. With power comes responsibility and so, the developer is responsible to make decisions and implement.

    I personally don’t like to be limited by the inadequacy of the programming language i use. It is my job to improve as years goes by and makes caution and clean design and goals part of my programming life.

    The way I see, the only area where C++ does not fit in today’s world is where no one gives a damn about how good the developer or a particular block of code is, but all they want is some output close to what they require.

    Developers wants to feel they are good developers right out of college. C++ takes time to learn, master and it feels great when you start using it. In fact, all this years of sound existence despite the arrivals of so called safe and powerful languages speaks a lot about the language itself.

    I am excited about C++0x and the features I’ve used so far are just awesome… I am just waiting to hear C# and Java catching up with C++ on those features soon :)… Man I just love that lambda expression feature in C++0x.

    No offense to Java/C# developers (since I do C# coding too as part of my profession). It’s the same negatives you believe are +ive for C++ and I see a very bright future for C++ than any other languages.

  20. Comment by Eric | 2008/06/23 at 15:11:13

    Good information….

    But what will happen in 10 years from now…. will C# still be there?

    If I start a software project now and I know the software has a live expectancy of 10 years and more… Should I start using C# and .Net?
    I know how things went with MFC and OWL. Specially if you look at project with a poor design.

    Let me know!!!

  21. Comment by Rhonald Moses | 2008/06/23 at 15:50:43

    Hi,

    To begin with; what I am going to say is strictly my own personal opinion, based on my past experience with both the technology, what i’ve read about them and what I have observed about the future goals.

    In my humble opinion, it’s a total waste to bank on proprietary standards and proprietary programming languages. I am not against them, but the way i see it, the open technologies are leap frogging the closed technologies. I don’t see much of bright future for c# 10 years from now where the disconnected desktops does not play much significant role.

    If it still exists (c#, etc), it will be entirely incompatible with what you develop now and most importantly the windows operating systems you will be using 10 years from now will be entirely incompatible to the software you develop right now.

    For example, I had developed a small piece of utility software during my university days (8 years back) which I still use despite the evolutionary change in C++. All I had to do was to re-compile the source code with gcc4 under linux and am still using it.

    If it’s the other way around; I’ll have to either re-develop using the framework available right now (at least a major portion of the code).

    Having said that, I am not implying that there won’t be wast changes 10 years from now. 10 years is too much ahead for us to think and so I can’t be 100% certain about anything, but i have enormous faith that C++ will sustain with big backward compatibility support.

    Java might survive (I use might since i am skeptical about the growth of java base – the size of java gets complex and bigger) since it’s open sourced.

    Though mono exists, no one is certain about the future of mono and I am sure within 3 years from now, Microsoft will be at even with Linux and other *nix operating systems. So you’ll have to take your application platform independent. In those scenarios, languages such as Java, C++ (GCC, QT), Python, Perl, PHP makes much more sense than .NET.

    I leave the decision to yourself.

  22. Comment by Ralf Sinoradzki | 2008/09/27 at 05:18:53

    I haven’t used C# so far, perhaps because I’m a bit afraid that I adopt some programming styles there that let me make more errors in c++ later.
    But today I’ve seen a video about the Currency and Coordination Runtime (CCR) that M$ is using in their M$ Robotics Studio. That programming paradigm looked interesting, so guess I have to learn C# anyway.

    For me, one advantage of C++ was always that I can really have an idea, how the code looks after compiling and what happening in memory, when it’s executing, except some low level optimizations with opcodes, inlining and such perhaps.
    So although you write object-oriented stuff, use templates etc., the code that the compiler is generating and the processor is getting to eat is exactly what you wrote. ( If you use a debugger, you can usally nail each C++ command or addressing mode down to one or a few opcodes )
    There is no hidden overhead or some mysterious stuff going on, once you understand C++ and the underlying hardware.

    The main drawback is of course that it has a steep learning curve. You need a deep some knowledge of the possible pitfalls, before you use a language feature, and you need obey some programming guidelines, otherwise C++ becomes a bug hell.

    Another thing that can be seen as a drawback is that you have to juggle with lots of libraries, which makes sense ofc from the C++ perspective, because C++ is a platform independent ISO standard. So all the stuff that’s platform specific isn’t meant to be part of the language.

    So in short, one big problem of C++ is that you have to think so much, what you are doing to avoid mistakes and that you can easily lose yourself in the details. And there is usually not one way to do something, there are several.
    Like I already said, one advantage is that once you understand the details of the language and can switch your brain to compiler perspective, you can more or less immediately see, why some code has undefined behaviour, crashes or is not efficient etc.

    One definite proof that programming C/C++ requires a lot of discipline have been the buffer overrun bugs and explots in the past. I guess most of them had either the reason bad coding style or simply that the programmer was just not understanding enough about the inner workings of c++, how the code executes and where the pitfalls are.
    Using parts of the language that you don’t fully understand or an “it compiles, so it’s working !” – mentality is suicide in C++.

  23. Comment by Jabberwock | 2008/12/08 at 02:20:32

    All I can say is every time someone tries to convince me to switch to C# from C++, I do some benchmarks and find that performance wise C++ still crushes C# by large factors (depending on the particular test). I am personally very comfortable in C++ and see no reason to switch. When I feel that C# is at least a third (on average) the speed of C++ I might consider it for some applications. Until then all these comparisions are meaningless to me.

  24. Comment by Dillon Burnett | 2009/01/13 at 06:15:54

    Something everyone needs to think about is what you are programming. If i need to do a lot off different things i use C++ (I still don’t know everything so this could be why), but if i am gonna focus on a few things some reason c# works better like. example using system files. Of course i don’t know c++ well. i can use little things, but that what the web is for!

    For good books on C# Simple Program Design C# which is for beginners and Program Design C# it is by Robertson or something, it is really good with showing easier ways to do things and how to get around walls. I got it from one of my teachers. After that i started getting into C# i never really used C# or C++ before that.

    I’m not sure what your classes are and who they are for, but also if someone wants something to do or mess with batch files are easy to make and can help speed simple tasks up! (that something for the beginners. kinda a mix of basic and C .)

  25. Comment by dave | 2009/01/23 at 20:09:26

    C++ is for those that have a strong computer science background matched with years of experiance using the language. It is just a tool that gives a lot of power to the programmer and thus how dependable and usable it is depends mostly on the ability of the programmer.

    C# and Java give less power to the programmer. Period. However for a beginer or intermediate level programmer, the baby sitting features of these languages hold serious value. The end product will be more secure, less buggy, and easier to maintain.

    I think it comes down to your background and the time you are wiling to invest.

  26. Comment by John S | 2009/02/04 at 01:21:34

    Interesting discussion, although the title is a bit of a misnomer. What is really being discussed here is managed versus unmanaged code – not C# vs C++. Both C# and C++ can create managed apps. C++ can also create unmanaged applications that are compiled directly to native code.

    Some other points for consideration:

    - As mentioned, the C# compiler does have an unsafe mode which allows pointers.

    - C++ is the only .net language that allows the creation of managed and unmanaged code in the same assembly (unsafe). Other languages can call unmanaged code (such as a windows API) but cannot create it. The following offers a nice summary of mixed mode development:
    (http://www.ondotnet.com/pub/a/dotnet/2003/03/03/mcppp2.html)

    - STL is available for managed code (managed C++ specifically) in the form of the STL/CLR libraries (Microsoft.VisualC.STLCLR.dll) in .net 3.5 distribution
    (http://msdn.microsoft.com/en-us/library/bb385954.aspx)

    - Managed code can usually accomplish the same functionality as an unmanaged app in about 35% of code that needs to be written by the developer due to the richness of the Framework – you are moving functionality from your code to the Framework. Less custom code means fewer opportunities for errors, and maintenance is easier. Managed code offers significant time savings in both coding and optimizing. Again, this is not a C# vs C++ statement, it is a managed vs unmanaged statement.

    - Although generally considered faster, being “native” is not a guarantee of performance.
    (http://msdn.microsoft.com/en-us/library/aa446521.aspx)

  27. Jim
    Comment by Jim | 2009/02/04 at 10:23:01

    dave: So, in order to be a good programmer or to have a powerful programming tool, the language must be hard and difficult to use?? Doesn’t make sense at all! It’s like saying that for you to be a good soccer player you should put some nails in your shoes…

  28. Nrx
    Comment by Nrx | 2009/02/22 at 11:06:39

    Recently I have been learning both C++ and C#. I have been avoiding CLR C++ as I cant see a point to managed C++ other than a very slight compiler optimization performance gain over C#. But C# seems to be much more productive and easier to learn and I find myself spending less time programming things that are of no relevance to the application I am developing, where as in C++ I find much time spent handling things that provide no functionality to the application but rather enable functionality.

    As for the threading and paralell programming topic, the .net framework makes it very easy and safe, I have not tried threading in native C++ but judging by what I have learnt so far, it will be a much more trechorous and unproductive endevour than in .net

    Just my 2 cents

  29. Comment by Alberto | 2009/04/03 at 14:39:19

    Hi

    In my opinion, the important thing about programming is not the skills the programmer shows, but the usefulness and stability of the applications. If the software is good, fits the clients, and is stable, it doesen’t matter what lies behind it, providing the programmer is able to mantain and further develop it properly.

    In this context, obviously C++ and C# live together in the deep and wide space of the programming sky, and are aimed at different kind of users, and different purposes. It’s useless to compare them side by side, because they are complementary, and so, the users benefit from the fact that there are two alternatives and not one, as before C# came into view.

    Clearly, C++ and C# have advantages and disadvantages, as everything in life. The choice will depend on many factors, and of course, one of them is the skill of the programmer. But others are: readability of the code, maintainability of the code, portability, etc.

    Finally, I am surprised to find such a hard defense of C++. C++ is undoubtely great. But many applications developed in it aren’t so great. In fact, many of them are awful, and that makes all of us suffer with erratic behaviour and random hangups while doing our everyday job. I am sure that if those applications had been developed using C# instead of C++, this would happen less. So, if the programmers aren’t just skilled enough to use a language as powerful as C++, well, we have two options: Have them all sent to intensive courses, or have them learn a language which is more suitable to them. Second is far much better, don’t ya think?

  30. Comment by Concerming multicore Programming | Colin B Maharaj | 2009/04/03 at 16:25:30

    I am a c++ Programmer
    Concerning threading and multicore programming, I attempted to give a go at this a few months back, even looking at some oneline MIT lectures on algoritms.

    The fact is that, at least for me, it is not too hard for me to write threading code. I use C++ Builder and it works for me.

    But the main concern is identifying where your code will be a good candidate for multicore development. E.g. sorting.

    I can sort 1,000,000 numbers serially (one thread) or split the list in two sort 500,000 in two threads then merge and get a performance increase by 95%

    But you have to knoe the algorithms and you got to have to vision to know what part of your code can benefit from this.

    These skills has nothing to do with the language set. Once you support threads, as far as I am concerned, you support multicore programming.

  31. Comment by Eric | 2009/04/24 at 06:29:37

    I think fall-through in switch statements is actually an advantage in C++. In C++, switch fall-through to avoid duplication of code for multiple cases. To achieve the same thing in C#, you would have to create a function to be called in each case.

    Also, you left off an important difference: C# supports only the object-oriented paradigm, forcing you to create a class for everything (stand-alone functions in C++ would become static methods in a class in C#), whereas C++ allows either object-oriented or procedural programming. People have different opinions on whether it’s better to force object-oriented programming or to support both styles.

  32. Comment by Eric | 2009/04/26 at 11:22:08

    You left out another important difference: C++ supports both object-oriented programming and functional programming, whereas C# supports only the object-oriented paradigm.

  33. Comment by Eric | 2009/04/27 at 00:59:41

    “C++ has 3rd party garbage collection, and in all flavors too.”

    True, but it’s nice when a feature is included with a language or its libraries, so that at least for portability reasons, you can be assured it will be there. In C++, there are certain things (such as garbage collection, GUI library, etc.) where you have to search for and decide on a 3rd-party library, and then you are stuck with whatever they release and are limited to whatever machine/OS platforms they release it for. For some, that’s not an issue though. Another disadvantage of 3rd-party libraries is that companies often charge quite a bit of money for their library.

    “Just pointing out that you can use std::vector.at() and you’ll get bounds checking.”

    That’s true, if you’re using a std::vector. However, that doesn’t apply if you’re using one of the myriad other types of collection classes out there.

    “I find it hard to think of situations when I’d use an array over a std::vector.”

    If you’re ever sending data over a socket or a pipe, you need to use plain arrays. You can’t transfer complex objects via sockets (you can only use the basic built-in types), and that might be true for pipes too.

    ” * no fall-through on switch-statements
    * arithmetic operations can be checked for overflow if required

    These sound pretty awesome. I’ll have to look into C# just for these feature alone.”

    Personally, I think lack of fall-through on switch statements is a disadvantage. Fall-through is useful when you want to use the same code for multiple cases in a switch, and to duplicate that in C#, you’d have to create a function that would be called in each case. The only reason I can think of why switch fall-through is not supported in C# is to avoid bugs caused by leaving out a break statement. Well, that’s not a hard bug to fix, really. So I don’t consider lack of switch fall-through to be a benefit.

  34. Comment by Erik2 | 2009/05/20 at 16:38:47

    C++ Still wipes the floor with C#. I have tested many times (even with 2008). I think the best I got for C# was 2.4X slower. The worst case was about 10X. I even had one case where I wrote my own custom heap in C++ and I got 42X faster. I won’t count that however. But it does point out a major advantage of C++. You can really customize things if want to go that far. I’ve seen a lot of C# vs C++ benchmarks posted by C# fanboys. I tend to consider them a lot of BS. Mainly because just writing your average test such as a sort or something along those lines, C# never even comes close to C++. In a 200K line application you aren’t going to go over every routine with a toothcomb trying to optimize it. C# is a decent language but I’m simply not even going to consider writing performance sensitive code in it as it stands. My numbers show it’s slower and real world experience with applications shows its slower.

  35. Comment by Eric | 2009/05/20 at 17:33:54

    I think it’s expected that C# would be slower than C++, given its garbage collection and the fact that it runs in a virtual machine. I think the real question is whether the speed difference affects the task at hand. Fortunately, you can still write in C++ in .NET using Managed C++, and you can call Managed C++ code from C#.

    Recently I found that if you want to use standard C++ (not Managed C++) code from .NET/C#, you can create a Managed C++ wrapper for it.

  36. Comment by Erik2 | 2009/05/21 at 00:46:59

    In my view managed C++ is the worst of both worlds. It’s not really C++ and in general just messes you up. I would use C# before managed C++. Again I don’t consider C# a bad language, just kind of slow. I might use it for some things due to ease of programming. However in most cases I end up working on stuff like games where the performance matters so anything other than C++ goes out the window. I’m still waiting for a new latest greatest compiled language to become accepted without all the quarks of C++. However at this stage of C++ is the only option for most of my work.

  37. Comment by Eric | 2009/05/21 at 01:46:39

    I do like C++ for its speed, and much of my own experience has been with C++. I agree with you that Managed C++ isn’t a language I’d choose to use, but if you ever find yourself in a job requiring you to use C# and you need to use some legacy C++ code, you’d have to do some Managed C++ to bridge the gap.

    I am a bit disappointed that most new programming languages that come about these days tend to use a runtime (i.e. Java and C#) or are interpreted (Perl, Python, PHP, etc.).

    Speaking of new compiled languages, there is a newer compiled language that I’ve heard about but haven’t used yet, called D: http://www.digitalmars.com/d

  38. bob
    Comment by bob | 2009/07/14 at 02:40:43

    I recomend a book called learn to program with C#
    By John Smiley It teaches in a strange but easy to understand way it`s
    like he teaches you in first person like your actually there any way
    i am under 13 and understand it. And expects no prior knowledge of
    any language.
    Cons:
    Teaches You In Note Pad
    Old book but still relivent
    Pros:
    Very good book easy to understand
    Even i can comprehend it:!:

  39. Comment by Arup | 2009/08/06 at 11:12:57

    Hello every one. I am a beginner in programming and was thinking what language to start with. On a web search regarding this I come a cross with this article and I have read all the comment posted on. But as I don’t any thing about any programming language what so ever it seems like thing flying above my knowledge antenna. Sorry for the interruption but as all experienced programmers are on board I was just being opportunist to ask if any one can suggest me language that I can start with. Your suggestion will very much appreciated. Thanks

  40. Comment by Eric | 2009/08/06 at 19:28:44

    Arup: From a practical standpoint, I think C# would be a decent first language to learn. It’s a modern language that is used by many companies and many people.

    However, there are features that C# doesn’t have. In the past, it has been said that C++, although possibly intimidating at first, is a good first language because C++ has many features that aren’t found in other languages (multiple inheritance, as an example). And people have said if you can learn C++, you can learn any language.

  41. joe
    Comment by joe | 2009/08/22 at 05:49:47

    I’m using both. C++ code for performance critical code and C# for database CRUD code.

    I feel a bit more loyal to C++, and it doesn’t really have to do with the language, I don’t really like the bully/illegal tactics of the company who makes .NET.

  42. Comment by saleh | 2009/08/26 at 06:52:14

    hello i dont like to chang ur topic .

    but i think you can use python and have a lot of advantage that there are in c# and c++ together. :smile:

    good luck for all of you

  43. Comment by Itay | 2009/08/31 at 03:26:21

    I used to think C# is much better.. but god damn, C++ got huge design advantages.. the generics are like class parameters, you can send any type of object (3, “abc” new Date()), while in C# you can only send a type (string, int, etc.)…
    not to mention the multiple inheritance…

    too bad C++ got such a ugly syntax.. and a lot of other disadvantages XD..
    actually i still think C# is much better.. but why the hell did they give up the C++’s generics??

    and BTW, you have mentioned a lot of C++ advantages which are actually dis advantages.. for example:

    any type can be thrown as exception (only classes derived from System.Exception in C#)

    this is much less organized like this..

    and this:

    allows default arguments on function parameters

    exist in C# 4
    (don’t ask me what took them so long)

  44. Comment by Eric | 2009/08/31 at 04:27:57

    I guess any feature could be considered an advantage or a disadvantage, depending on how you look at it.

    Being able to throw any type as an exception is flexible, and isn’t really a problem if you have a catch (…) block, which will catch anything. I guess the problem is that it can be hard to know what will be thrown in C++, so I think C#’s exceptions are nice in that you can always catch System.Exception as a default and still be able to look at some of the properties of the exception object.

    I’ve also heard some people say that C# is slow compared to C++, and some things that need the speed still need to be done in C++. For speed, I wish C# would at least compile down to native code rather than a runtime object (C# apps use the .NET runtime, similar to Java apps using the Java runtime). Also, C#/.NET’s garbage collector adds an element of randomness to the application, which might sometimes be a bad thing..

  45. Sam
    Comment by Sam | 2009/09/11 at 11:12:55

    I think if somebody wants to work in Microsoft, he or she must learn C#.
    For the beginners I can just say start with C programming language and then pick C# or Java.

    The point is her to understand programming and to produce something which can be achieved in quickest possible time.

    C++ is hard to learn and master but to learn C++ you need a professional programmer who at least have 5 to 10 years experience in C++.

    A cook book or a beginning book can’t help you to learn C++. A good teacher/programmer can really tell you how to learn C++ without mistakes. I started to use C++ after C and Java/C# programming projects and use to be in love with C++, because of its compile time performance its rocks, but I feel my self home init, because I have learned good object oriented skills in C# and Java.

  46. Sam
    Comment by Sam | 2009/09/11 at 11:14:49

    I think if somebody wants to work in Microsoft, he or she must learn C#.
    For the beginners I can just say start with C programming language and then pick C# or Java.

    The point is here to understand programming and to produce something which can be achieved in quickest possible time.

    C++ is hard to learn and master but to learn C++ you need a professional programmer who at least have 5 to 10 years experience in C++.

    A cook book or a beginning book can’t help you to learn C++. A good teacher/programmer can really tell you how to learn C++ without mistakes. I started to use C++ after C and Java/C# programming projects and use to be in love with C++, because of its compile time performance its rocks, but I feel my self home init, because I have learned good object oriented skills in C# and Java.

  47. Sam
    Comment by Sam | 2009/09/11 at 11:17:21

    Some Books by Bjarne Stroustrup the inventor of C++.
    • Bjarne Stroustrup: Programming — Principles and Practice Using C++. December 2008. Addison-Wesley. ISBN 978-0321543721. 1264 pages. Softcover.

    • Bjarne Stroustrup: The C++ Programming Language (Special Edition). Addison Wesley. Reading Mass. USA. 2000. ISBN 0-201-70073-5. 1029 pages. Hardcover.

    • B. Stroustrup: The C++ Programming Language (3rd edition). Addison Wesley Longman, Reading, MA. 1997. ISBN 0-201-88954-4. 920 pages. Softcover.

    • Bjarne Stroustrup: The Design and Evolution of C++. Addison Wesley, Reading, MA. 1994. ISBN 0-201-54330-3. 472 pages. Softcover. (Often called D&E).

    • Bjarne Stroustrup: The C++ Programming Language (2nd edition). Addison-Wesley, Reading, MA. 1991. ISBN 0-201-53992-6. 696 pages. Softcover.

    • Margaret A. Ellis and Bjarne Stroustrup: The Annotated C++ Reference Manual. Addison-Wesley, Reading, MA. 1990. ISBN 0-201-51459-1. 478 pages. Hardcover. (Often called “The ARM”)

    • Bjarne Stroustrup: The C++ Programming Language. Addison-Wesley, Reading, MA. 1986. ISBN 0-201-12078. 326 pages. Softcover.

  48. Sam
    Comment by Sam | 2009/09/11 at 11:18:47
  49. Comment by Mirek | 2009/09/12 at 12:02:49

    IMHO only C# advantage over C++ are it’s more extensive libraries.

    * garbage collection
    3rd party or your own library. actually it’s easy to code (however has uses only when coder is lazy, because one which isn’t lazy makes his own heap)

    * array bounds checking
    hmm.

    * types have a defined size (e.g. a long is 64Bit)
    that is why there are macros for your code to see under which compiler you’re compiling. make your own long

    * strings are encoded in UTF/16
    wchar_t (windows UTF16, unix usually UTF32)

    * autoboxing – every type can be treated as if it inherits from object
    ehm.. C# Best Practice – Do not use boxing and unboxing.

    * supports constructor-chaining (one constructor can call another constructor from the same class)
    that is why I usually write init method

    * static constructors (run before the first instance of the class is created)
    static instance in class

    * exceptions have access to a stack trace
    easy to do if you can take being platform dependant

    * advanced runtime type information and reflection
    if you intend to do this (say with serializable objects etc.) you may as well write it.

    * supports variadic functions nicely
    well as boxing isn’t recommended…

    * built-in support for threads
    once again, it’s just classes written for C#. I haven’t noticed any autolocking of variables used between different threads

    * no need for header files and #includes
    well, I guess this is plus

    * no fall-through on switch-statements
    as I actually use them sometimes, it means extra goto line

    * arithmetic operations can be checked for overflow if required
    well, once again this can be considered plus. however the expense of this is very close to doubling integer size and then checking upper half if overflow occured. so can as well be done C++

    * objects must have a definite value before being used
    considering the way C# handles member variables initialization (e.g. if not specified zero), it’s IMHO worse than not initializing them at all.
    besides that some C++ compilers also give warnings about uninitialized variables.

    * attributes can be attached to classes and retrieved at runtime
    well, it isn’t bad at all. but as one can guess, you can make your own base class for all classes you write thus having same functionality.

    * access to class members / functions is done only by the dot (no more -> or ::)
    well this is about the “no pointers” in C#, no pointers no deref.

    * conditional functions (e.g. for debugging)
    hmm?

    * structs and classes are actually different (structs are value types, have no default constructor in general cannot be derived from)
    well, I guess this comes from what C# is. struct is value while class is object. I don’t really see a + here. it’s just different.

    * supports properties
    behind the scene on += with properties C# compiler does get and then set. I really see no positive in this. otherwise it’s nice if you need some validation of input. but IMHO input should be validated on input instead per every set.

    * readonly members are const, but can be changed in the constructor
    never had need to have const member taking space in instance.

    * finally block for exceptions
    once again some C++ compilers have this extension (guess who’s), however can be as well emulated with try-catch which will compile anywhere

    * arrays are objects
    as are std::vector, std::deque etc.

    * support for anonymous functions
    templates

    * supports the base keyword for calling the overridden base class
    once again some C++ compilers have __super. however this only works as hoped for with single inheritance and thus may instead bring bugs instead of reducing them. (AFAIK that is why it was rejected by other than M$ compilers)

    It may seem I dislike C#. it isn’t truth, it actually saves you some typing time. I just like C++ a lot more. In the end it’s only about the libraries you have and use for which language. If you have them for C++ you don’t need C#.

  50. Comment by Eric | 2009/09/12 at 21:26:56

    Mirek: I think you have some valid points, but I think some of the points in favor of C# are good, too.

    I’ve used C++ quite a bit in the 5 years I’ve been doing software professionally, and I like C++. However, with some of the frustrations I’ve experienced with C++ and the time taken to do certain tasks, I can appreciate some of the features of C#.

    As a more recent language, the C#/.NET standard library includes things that are used more recently, such as threading, GUI API, sockets, etc. Including things in the language’s standard library is very beneficial, I think, because that means they will (or should be) included in any standard implementation of the language, so you don’t have to worry about your software running only on one particular platform because one of the libraries you use only works on that platform. For instance:

    * Standard thread class
    As you say, this is simply just a threading class written for C#, but the difference is that it’s part of the .NET standard library. Thus, you can be assured that it will be there on any platform where .NET is implemented. So, even the Mono runtime (for Linux) would include this class.

    * Standard GUI API
    WinForms is the GUI library that is part of the .NET standard, meaning you don’t really have to worry about which GUI library to choose and if you will be limited to one platform. The Mono runtime added support for WinForms a while ago, so you should be able to run WinForms apps on Linux now, rather than just Windows.

    * Standard sockets API
    Again, this is useful because many apps these days require networking support.

    With C++, if you want any of these features, you have to go look for what libraries are available to support these features and also consider what platform(s) those libraries support, then how to install those libraries (if you don’t have them already), etc.. It’s nice to have features that are already there, part of the standard of the language. Additionally, since C++ does not include things like a GUI library, threading, etc. in its standard library, many different projects use different libraries, so as you take a look at different C++ projects, you have to spend time getting familiar with a different library, perhaps making it compile on your computer (if it doesn’t already), etc..

    Also, you’ve talked about the following:
    * objects must have a definite value before being used
    I think this is actually a good feature in C#. It’s better than letting a variable have some random value based on whatever is in memory at the time the variable is allocated. Predictable behavior is better than random behavior. Also, by refusing to compile code that doesn’t initialize variables, C#’s compiler forces you (perhaps reminding you) to initialize your variables, which helps prevent unintended random behavior.

    * finally block for exceptions
    You say this can be emulated with try-catch? The finally block is in addition to try-catch.. So I’m not sure how you can emulate a finally block with a try-catch. You also say that some C++ compilers support a finally block – But it’s certainly not a standard in C++. Again, having a feature as standard means you can (or should always be able to) always rely on that feature being there.

  51. Comment by Mirek | 2009/09/14 at 19:24:16

    @Eric
    - You say this can be emulated with try-catch? The finally block is in addition to try-catch.. So I’m not sure how you can emulate a finally block with a try-catch

    class nothing : public std::exception {};

    #define _TRY try { try {
    #define _END_TRY throw nothing(); }
    #define _FINALLY catch (…) {
    #define _END_FINALLY throw; } } catch (nothing&e) { }

    void test() throw(…)
    {
    void * ptr = 0;
    _TRY
    ptr = malloc(1);
    throw 0;
    _END_TRY
    _FINALLY
    if (ptr)
    free(ptr);
    _END_FINALLY
    catch (int e)
    { }
    catch (…)
    { }
    }

    finally is executed before catch (which may or may not be a problem), can’t think of a way to put it after catches atm. anyways it’s ugly and IMHO it’s better to depend on RAII

    As for .NET being multiplatform, I have to agree that is a big +, but IMHO remains to be seen how much multiplatform it will be (or how delayed the other platforms will be). Didn’t seen too much effort on M$ side. (but maybe it’s just me not reading news).

  52. Comment by Eric | 2009/09/14 at 19:46:11

    Mirek – I’m not quite sure I understand how that emulates try/catch/finally as seen in C#. The 0 is thrown before you use the _END_TRY, so the nothing will not get thrown. And since your _FINALLY macro catches anything, the 0 that you throw would be caught by the _FINALLY block; is that the behavior that is intended? I’m also used to seeing a finally block at the end of all the catch blocks.. In C#, I had thought the finally block had to be at the end (after all catch blocks), but doing a search, maybe it’s not.

    As far as .NET being multi-platform, you’re right that Microsoft hasn’t put forth the effort to implement it for other platforms. That’s something I don’t really understand. .NET was designed to be a multi-platform runtime, like Java, and .NET applications can run anywhere the .NET runtime is available. I don’t know why Microsoft went through the effort to make a multi-platform runtime environment but only implement it for Windows. They probably feel that they would lose market share if they implemented it for Linux or OS X. In that case, they could have made .NET applications faster and more efficient by making .NET languages compile directly to a native executable rather than something that requires a runtime.

    Mono, the .NET runtime for Linux and other operating systems, was made by other companies. That is what has brought .NET to Linux, but being made by a 3rd party, it’s at least one revision behind Microsoft’s spec. The current version of .NET is 3.5, but last I heard, Mono still only implements version 2 of the .NET runtime.

  53. Comment by Mirek | 2009/09/15 at 12:39:28

    Eric – the previous code works fine (but _FINALLY was called before any user defined catch) and return was not handled (forgot about that). the following works exactly like C# (unless I forgot something again) try-catch-finally, but it’s slow, hard to use, and really ugly.

    class nothing : public std::exception {};

    #define _TRY \
    { \
    int __my_status = 0; \
    try \
    { \
    try \
    { \
    try \
    { \

    #define _TRY_V(return_type) \
    { \
    int __my_status = 0; \
    return_type __my_return; \
    try \
    { \
    try \
    { \
    try \
    {

    #define _END_TRY \
    throw nothing(); \
    } \
    catch (nothing&e) \
    { \
    throw; \
    }

    #define _FINALLY \
    throw nothing(); \
    } \
    catch (…) \
    {

    #define _END_FINALLY \
    throw; \
    } \
    } \
    catch (nothing&e) \
    { \
    if (__my_status) \
    return; \
    } \
    }

    #define _END_FINALLY_V \
    throw; \
    } \
    } \
    catch (nothing&e) \
    { \
    if (__my_status) \
    return __my_return; \
    } \
    }

    #define _RETURN \
    { \
    __my_status = 1; \
    throw nothing(); \
    }

    #define _RETURN_V(return_value) \
    { \
    __my_status = 1; \
    __my_return = return_value; \
    throw nothing(); \
    }

    int test()
    {
    // the _V macros can return value
    _TRY_V(int)
    // something. to return from here _RETURN macro is required, as return does not run _FINALLY block
    _RETURN_V(0)
    _END_TRY
    // user defined catch block(s)
    catch (…)
    {
    // something. to return from here _RETURN macro is required
    _RETURN_V(-1)
    }
    // required finally block
    _FINALLY
    _END_FINALLY_V

    return -2;
    }

    Oh well, end of not really related stuff to this article.

  54. Comment by UUps | 2009/09/18 at 00:19:38

    Wow,

    regarding the original item “C++ vs. C#”, (btw: started about 2 1/2 Years ago) the discussion went a little bit “out of range” (that’s my opinion, of course).

    What culd be better: C# or C++? (I think, that could be the original question :wink: ). My answer: It depends on the experience of the programmer, the software that has to be developed and on the development utilities that are avail.

    I am actually developing in C++, and my last researches “said” I do it in future as well.

  55. Comment by Matt Osborn | 2009/10/25 at 16:25:58

    Whatever can be done in C# can be done in C++. The reverse, however, is not true.

    C# has a huge advantage with its .NET platform. C# has a huge disadvantge as it is limited to its .NET platfrom.

    The real advantage to C# is not language specific as C++ is clearly superior in that regard; it is the cost of software development, i.e. progammers, where C# offers tremendous advantages.

    C# programmers need not understand the differences between pointers and references; nor must they understand the relationships between the stack, the heap and static objects.

    C# programmers need not concern themselves with multiple inheritance or the advantages of the same.

    C# programmers need not concern themselves with coding embedded software as they cannot do so.

    C# programmers need not concern themselves with the intricacies of memory management, nor are they able to avail themselves of its advantages.

    C# programmers need not concern themselves with computing’s ‘big picture’; it is hidden from and managed for them.

    C# programmers will initially be more productive, but will soon plateau, finding themselves repeatedly grinding out boring and uninteresting variations of the same code.

    If you are desirous of a creative career in computing programming, C++ offers far more opportunities.

    C# programmers will tend to be less flexible, less creative and cheaper than the experienced C++ programmer.

    In summary, C# is a manager’s language choice while C++ is the language choice of the programmer.

  56. Comment by Nicholas | 2009/11/13 at 23:48:56

    Matt this comment is true

    C# programmers will initially be more productive, but will soon plateau, finding themselves repeatedly grinding out boring and uninteresting variations of the same code.

    If you are desirous of a creative career i

    I hate my job….. I’m so sick of the reputation.

    Im sure C++/CLI will make a difference but unsirtin because of silverligt and WPF

  57. Comment by John | 2009/12/12 at 20:31:18

    Getting back to the original topic of the post: As someone who has programmed in C++ for over 10 years, it’s good to see a resource that helps me understand the differences I am running into as I start learning C#. So thanks for the original article.

    As for the rest of the comments, they remind me of the old C vs. Assembler (or was is Pascal vs. Assembler) debates of a couple of decades ago.

    So, to add some more fuel to the fire:

    - What are you writing code for. C# will never be able to run on a truly embedded system where 64M (not G) of combined code and data space is huge. C++ can be used (but one has to be careful).

    - C++ is dangerous. As I once read “C++ let’s you shoot yourself in the foot with style.”

    - Discussion of the language should be separate from the discussion of the support frameworks and toolsets as much as possible. It’s easy to throw mud at C++ and say it doesn’t have as much power as the .NET libraries for C#. But it’s like comparing a diesel motor to a car. Yes, one has seating for 5 and the other doesn’t, but they are different things. If you really want to compare library support and frameworks, then you need to consider Qt and GTK and other C++ friendly frameworks. (I personally love Qt — it’s a lot more than just a graphics layer.)

    - C++ will always run on more platforms than C#, simply because of the need for the management layer.

  58. Comment by Tom R | 2009/12/27 at 11:56:52

    John said, “- What are you writing code for. C# will never be able to run on a truly embedded system where 64M (not G) of combined code and data space is huge. C++ can be used (but one has to be careful).”

    That’s not necessarily true. The .NET Micro Framework is designed to run on devices with very little memory, much less than 64MB (closer to 320kB actually.) The framework even includes a managed device driver model for writing device drivers in C#.

    http://www.microsoft.com/netmf/default.mspx

    The newest version of the .NET Micro Framework was also open-sourced under the Apache 2.0 license.

  59. Comment by Bartosz Bielecki | 2010/01/14 at 14:52:57

    In an age of grandmothers knowing C# & JAVA, I would like to say a few good words about so despised C++.

    Short rundown of my comments to your pros/cons list:
    —– C# —–

    Garbage collection:
    It’s hard to say whether or not this is good feature. Sure, it’s nice to have it and make the machine deal with your laziness, but you pay a high price with decreased system performance, which is something you don’t want to do. And don’t let anyone sway you by saying “Who cares about self-resource-management in times of iCore7?”.

    Array bound checking:
    std::vector?

    Huge .NET-framework library:
    Awesome stuff, true, but don’t forget about STL, Boost and thousands of great C++ libraries spread all over internet.

    Types have defined size:
    Plus, period. Thankfully we have a preprocessor to ease our life a bit.

    Strings are encoded in UTF-16:
    You can use wchar_t, or wait for C++0x (right around the corner) for some serious UTF-8 support.

    Constructor chaining:
    C++0x delegations.

    Advanced RTTI:
    I don’t extensively use RTTI, and I don’t find it that interesting. IMHO!

    Supports variadic functions nicely:
    If we mean the same, take a look at Variadic templates (C++0x).

    Built-in support for threads:
    There isn’t one in C++, yet, but there are already a few libraries for handling threads (eg. Boost). In C++0x, however, there will be a real support for threads.

    No need for header files and #includes:
    I got used to them, so it’s not that bad for me :).

    No fall through through switch statement:
    That is just another approach to case-switch. If you use case-switch ONLY to have a if-type list of possible values of a variable, then you are probably happy. On the other side, C++ allows nice techniques, so that for example some steps are omitted, when not needed, and you can clearly see on what ‘level’ of case some things will happen. Oh, and don’t tell me that writting break; is so painful.

    Value must have a definite value before being used:
    Good C++ practice made as a rule in C#… and this time it’s really helpful.

    Only dot operator:
    Hmmm… is it that good? I mean, it’s very convenient, but not knowing whether or not you are calling the method by a pointer, by a normal reference to an object, or as a static method of a class, makes me wonder if you can understand your code. I like the . (dot) -> (arrow) operator distinction as I know on what kind of data I am working.

    Arrays are objects:
    As are std::vector elements.

    I would like to end my comment with saying, that I – in fact – see many pros of C#, but imho it’s a language who basically tells you this:”you don’t have to (have limited or no access to) understand inner workings of your code – happily write your code and everything will be done for you; who cares about performance in era of super-fast computers, anyway?”.

    Tom R said:
    “That’s not necessarily true. The .NET Micro Framework is designed to run on devices with very little memory, much less than 64MB (closer to 320kB actually.) The framework even includes a managed device driver model for writing device drivers in C#.”

    Don’t feel offended but you amused me :). 320kB?? And C# developers feel proud of themselves? Recently I programmed an ATmega8 which *8*kB of memory. I wrote the code in C, but I had like 4kB left, thus I am pretty sure I could be able to write the code in C++. You were probably thinking about some TRUE devices like palmtops or such things, but even taking really powerful AVR, you get only 128kB. With such amount of memory you can create a serious program in C++, and I doubt you even write a single line of code in C#.

  60. Comment by Eric | 2010/01/14 at 20:39:34

    Bartosz Bielecki – Even though I’m far more experienced with C++ than with C#, and I like C++, I can understand some of the things in C#, which you have discussed:

    Only dot operator:
    The reason C# has only a dot operator is because everything is a pointer by default in C#; C# doesn’t need two different operators for accessing object members. When you understand the language, you won’t have a problem understanding your code, as you say.

    Advanced RTTI:
    I think it’s actually a really nice feature for a language to be able to let you analyze the objects and types you’re dealing with at run-time. One thing this helps with is loading objects and functions from a DLL. With C++, you have to jump through some hoops to use DLLs because everything with C++ needs to be defined at compile-time. However, C# can simply open a DLL and give you a list of the objects/functions in the DLL at run-time, which makes it easier to use the DLL.

    Garbage collection:
    While I agree with you that it’s hard to say if this is a good feature, I’ve heard people say that garbage collection can actually improve performance because you aren’t de-allocating your objects all the time. By deferring that operation, they say, you can actually get improved performance in the short term, and the garbage collection system can wait until the application is idle to collect the garbage. That said, though, I’m all for doing careful memory management, so I’m not really sure that garbage collection is a compelling feature.

  61. Comment by Tom R | 2010/01/20 at 02:12:14

    @Bartosz

    What does programming on at ATmega have to do with my comment? I was responding to someone’s claim that you cannot develop C# programs that will run on devices with less than 64MB of memory. I mentioned that it is in fact possible utilizing the .NET Micro Framework.

    I’m very happy for you that you’re such a great developer you can write a program in C and run it on a ATmega8. You must be a very capable programmer.

  62. Comment by Rhonald Moses | 2010/01/20 at 04:48:36

    I see that even after 2 and half years, this thread is alive :-)

    In short; C++ is a good language which can be used only by people who knows programming and can take responsibility in what they do. I love it because it does not come in between and let you do what you’d like to do; either good or bad.

    C# is designed to pull Java developers mainly emulating already familiar C/C++ syntaxes. It limits the language usage by taking care most of things [I personally don't require Garbage Collector] that normally is the responsibility of the coder himself. Also it has made the programmers lazy. But still it’s a good language.

    I am amazed by the way C++ still standing amidst all wanna be best languages. Even now, most of the high intensive applications uses C++ [AutoCad, Maya for example].

    So, if you are planning something that require to operate at hardware level as well as high level and cross-platform, then go for C++. Otherwise, it’s better you go to some managed languages.

  63. Comment by Eric | 2010/01/20 at 05:11:28

    I think C++ and C# both have their merits. Compared to C++, I think C# has features that can help a developer be more productive for many things, but C++ is still required in situations where you need to do more low-level tasks or tasks that are more speed-sensitive or timing-sensitive (somewhat analagous to writing in C++ vs. assembly code).

    Not long ago, I read that Microsoft may phase out Managed C++. Does anyone know if that’s true? I certainly hope not – Managed C++ provides the bridge from C#/.NET to C++ and legacy code. I imagine there are many useful libraries and pieces of code written in C++ that would not be accessible from C# were it not for Managed C++. Also, a company might have its own C/C++ codebase that it might want to re-use in C# (via Managed C++) rather than spending time (and money) re-writing it in C#.

  64. Comment by Yan Frieston | 2010/02/05 at 02:33:15

    Which is better in terms of massive scientific calculations? Please give help!

    Many thanks

  65. Comment by Eric | 2010/02/05 at 02:37:53

    For massive scientific calculations, I’m not sure either language would be better. However, one thing I think is nice about C# is that it includes a decimal numeric type, which does math in base-10 rather than base-2 so that you don’t get binary roundoff error. I know that numeric precision (i.e., significant figures) is important in doing scientific calculations, so that could be a plus for C#. There are base-10 numeric libraries available for C and C++, but some cost money and some can only be used in Linux or only on Windows, etc.

  66. Comment by Rhonald Moses | 2010/02/05 at 05:32:00

    For scientific calculations C++ will fare well; but FORTRAN is the best. You can actually build modules in FORTRAN and include them in C/C++.

  67. Comment by Bicubic | 2010/02/14 at 03:54:45

    I think most people who say they’re “done benchmarks” and found C# “x times slower” don’t actually work in the real world. Starting with the fact that neither C++ nor C# have any intrinsic speed. That’s determined by the libraries, the compiler and the architecture its compiling for.

    There’s only a small handful of real world scenarios in which these artificial benchmarks have even remote relevance to what you will actually be doing. Unless you’re writing quake 5 or a number crunching supercomputer client app, there aren’t many other cases where you will feel and perf loss between native and managed code. Funnily enough, C# is being trialed for cluster computing and has been found to have surprisingly little overhead.

    Getting back to the real world, most applications written are fairly lax on perf and heavy on gui and logic. Most businesses that write them focus on the best cost/benefit value and realize that writing managed code is considerably faster and more maintainable than something like C++.

    While working in the industry as a younger programmer, I found that many businesses still tend to avoid .net languages because their senior ‘old school’ programmers ‘hate’ the language without actually having written a single line of code in it. And I am very glad to see that as the number of younger programmers increases in the workplace, we are shifting that opinion towards objectivity and away from religious ‘i want to know what the cpu is doing’ crap. In 9 cases out of 10, C# is a better language choice for solutions in business, engineering, automation, media, data handling, etc applications; simply because you’re going to spend a fraction of dev time creating code to do the same things, if nothing else.

  68. Comment by Rhonald Moses | 2010/02/14 at 04:17:55

    Sorry mate! I don’t buy everything [except the part that benchmarks are waste]. Except Business; I don’t see C# being used ‘much’ in other fields and definitely not in Media [AutoCad, Maya all are in C++] and Engineering [C has upper hand here still].

    For Business and Business automation; yep C# has reasonable penetration. But when it comes to Web, PHP still rules the world dude.

  69. Comment by Eric | 2010/02/14 at 09:19:23

    In reply to Bicubic, I agree about the cost/benefit factors. As someone who has developed software in C++ for a while, C# seems better at letting the developer be more productive than C++. I’m also a younger developer who has been working in the industry, but not for too long.

    However, I think there are perfectly valid reasons why C++ would be chosen as a development language. I suppose one reason is actually why you wouldn’t want to choose C#: C# is a proprietary language, created by Microsoft, and Microsoft has no interest in developing a C# compiler and .NET runtime for platforms other than Windows. 3rd-party .NET implementations do exist for other platforms – the most prevalent being Mono – but Mono tends to be a step or two behind Microsoft’s implementation, and there is a chance that Microsoft could do something (legally or technologically) to impair 3rd-party implementations from being developed. This is in contrast to Java, where Sun develops the runtime for most platforms currently available. C++, on the other hand, is an open language, and compilers exist for almost all platforms.

    Also, I have heard that even in C#/.NET projects, C++ is used where performance is very important. C and C++ also seem more common on devices with limited RAM and storage space, although I’ve heard of C#/.NET for those devices as well.

    I suppose the thing that makes me hesitate most about C# is that it’s most strongly tied to Microsoft and Windows. If a company wants to develop software only for Windows, that’s fine, but sometimes it can be important to consider making your software available for other platforms as well too. That’s just another cost/benefit ratio to consider though: You have to consider your customers (or potential customers) and try to decide how much money the company could make by making the software just for Windows or also for Linux/Mac too.

  70. Comment by Savan | 2010/02/23 at 23:46:33

    :cool: :grin: :evil: :mrgreen: :neutral:

  71. Comment by Haridas Pal | 2010/03/09 at 12:40:29

    :mrgreen: :neutral: :twisted: :arrow: :shock: :smile: :???: :cool: :evil: :grin: :idea: :oops: :razz: :roll: :wink: :cry: :eek: :lol: :mad: :sad: :!: :?:

  72. Comment by marck_don | 2010/05/03 at 06:08:18

    Yes, I agree with nihangshah that you should start with C because then you can fairly easily progress onto any one of the C derivative languages, to name a few: C++ ,C# ,C– ,objective C, C++ .NET. C++ is probably the best as you can build apps for all platforms where as C# is only for windows, objective C for MAC apps etc.

  73. Comment by Vamp898 | 2010/05/27 at 19:06:04

    How to say. That is just nonsense

    I mean the talk about Programming Languages.

    Take a look at Google. On there Anrdoid stuff they use Java

    On there Web-Platform they use Python. Chrome OS/Chrome/Chromium is wirtten in C with GTK+

    Nokia uses C++ with Qt

    What do we see? The matter is not the Language. Its the guy who writes the language.

    Desktop Envirionments like KDE and GNOME even now turn to use JavaScript and also Windows (in case of his huge copy_from_other progress) starts to do so.

    Its not just “A Business will use C# becease they can develop faster with less problems” or something like that.

    And Desktop Environment works better if its written in C or C++

    Small fancy eye-candy games that you play for 5 Minutes to calm down in breaks are maybe better written in JavaScript

    btw. C# runs very very very good on Linux (http://www.mono-project.com/Compatibility) the GNOME Project uses more and more C# (Banshee, Tomboy, Beagle, F-Spot, GBrainy)

    With Mono you´re able to run C# Applications on Windows, Mac OS X (in case of that its just a cheap Unix system) and Linux

    Maybe C# is not a bad language at all but the performance boost you get with C++ is just too high

    http://shootout.alioth.debian.org/u32q/benchmark.php?test=all&lang=csharp&lang2=gpp

    if someone think it worths it…… why not

    But with toolkits like Qt, C++ is defenetly the better choice

  74. Comment by CATremblay | 2010/05/31 at 22:44:25

    Jim: No, what Dave is saying is that great power brings great responsibility. An f-16 is more difficult to safely fly than a go-cart. You are unlikely to, for example, accidentally destroy an apartment building with a go-cart, even if you have never used one before. Also, there are things can f-16 can do that a go-cart certainly can’t.

    More like soccer vs jet-pack-soccer.

    I don’t necessarily mean this as a reference to C# vs C++, I don’t know C# at all. But it works as an metaphor for other things such as DOS vs Linux. Where for one example, linux is more stable but there is no undelete.

  75. Comment by NoobFor9Years | 2010/06/21 at 13:41:24

    C# and C… I use them both…

    1. Coming from C++, I could say that C# is much better in my case. I am very productive using it. I could write apps faster than using C++. And I can deliver it to the client fast.
    2. Garbage collection is a big plus.
    3. Cross platform… Yes… I wrote a C# app and was able to use it in Opensuse Linux (Mono) w/o any recompilation… That’s a very very hugeeeeeeee plusssss….
    4. Speed… it always depends on the algorithm/flow created by the programmer… I have a case wherein my boss always told me that C# is a lot slow because it relies on .NET, they have their C++ app and boasting that I could never beat it’s fastness… It has lots of calculation + some hardware interactions. and after three days of development, we have a benchmark: their app takes 15seconds, and my C# app takes 1.3seconds… after that, I never heard a single word from them on that day :D :D :D

    Speed isn’t everything :)

  76. Comment by Vamp898 | 2010/06/21 at 14:19:10

    Sure if you´re an stupid programmer and have no knowledge of Memory Management you should better write good C# apps than bad C++ apps

    But you have to be a really bad programmer to write an C++ App that is slower than an C# app.

    And why not take the best from both? Vala for example have the same Syntax than C# but it doesn´t use .NET.

    The Source gets converted into C and then gets compile by your favourite C-Compiler (for me its GCC)

    So you have automated Memory management, easy syntax and all the other pussy stuff but still have the great speed

    http://live.gnome.org/Vala (also take a look at the Wikipedia article)

    And you can´t compare C++ with C# in every case. C# have a big library behind it named .NET with which you are much more productive than with ANSI C++

    But for example with Qt you can write C++ apps 1000x faster and with less code than with C# and .NET and you dont lose and ms of speed.

    So if someone really says he have to use C# becease of advantage XY than he just dont know how to compare (99% Windows users)

  77. Comment by Greg | 2010/06/25 at 15:40:27

    @Bicubic:

    I find your argument about ‘old school’ programmers amusing. I am one of the younger programmers where I work, but I started in computers very early. I tought myself a few languages and attended college where I learned others.

    I am open to new ideas. I work with other fresh minds and most of them are all about .NET and C#. Fact is, as I talk with them about languages and programming, it has become painfully obvious that they aren’t polished programmers. They do not know how to write tight code. They also seem to be clueless how to fully leverage C++. I blame poor teachers for this. My C++ teacher in college was terrible. IMO, most programming teachers teach like math teachers – unable to create a compelling real-world example of why you should use specific tools and why to use them a certain way.

    These C# proponents I work with have decent troubleshooting but not excellent. These are sharp guys with holes in their knowledge. Nothing personal to them or the other C# proponents, but C++ and the people that are skilled in it just seem to produce the best, fastest, most well though-out code. As someone else pointed out in this thread, C# is for beginner and intermediate programmers. IMO, it’s the programmers that are intermediate that think they are polished that seem to tout C# as the better language.

    While I am making a case, the argument about standard libraries doesn’t make sense to me. It makes sense if you reinvent the wheel over and over again. Any programmer is going to make a set of their own libraries they use from program to program. Even in C#. While one may spend some extra time initially building some libs to make C++ friendlier for quick programming, the end game for a decent programmer is similar productivity for new programs. As a for instance, if I am writing a new C++ program that interfaces with XML, I don’t code an XML class all over again. I use the one I already made. I’d rather have my C++ libs than C# without my libs.

    At the end of the day, there are too many technical things to do and not enough great programmers to go around. This argument ends up as academic. C# is here to stay and C++ is here to stay. Use the tool that matches your skill set + target hardware and enjoy bringing programs to life.

    -G

  78. Comment by Tikiwiki | 2010/06/26 at 01:29:41

    C# is the Java bitch of the future, it will take time for the world to think differently.

    Yessssss!

  79. Comment by renelda | 2010/07/25 at 15:25:13

    Anjuna Moon is an egotistical oaf at best.

  80. Comment by Joshed | 2010/07/29 at 02:36:48

    wow I can say that this thread can go on forever since opinion is an opinion. The person who loves C# will always defend it so as with C++.

    In my own point of view what suites you best is what you should use.

    whichever will make you succeed in your career will always be the best for you.

    Good luck to all :p

  81. Comment by Rhonald moses | 2010/08/03 at 14:05:33

    I am .NET Developer for past 5 years professionally and C/C++/Python developer on personal projects.

    I can say that; C/C++ is all about the power in the hands of the developer and it’s up to the developer to do his job – make a better program.

    C# is all about simplicity. It’s good for someone who doesn’t require to know every detailed of programming [like allocating, de-allocating memory] can can start becoming a developer in flash.

    Even after this many years C/C++ being the top choice for development [always in top 5 for past x many decades] proves my point.

    http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

    besides, it’s best to stick to the comfortable tool.

  82. Comment by Bjarne Stroustrup | 2010/08/27 at 17:00:52

    C++ will rule forever. If you would like to know the secrets of c++, feel free to contact me at bs@research.att.com. If i do not reply within considerable time, you can also try bs@cs.tamu.edu. Thanks you.

  83. Comment by Rhonald moses | 2010/08/27 at 17:39:24

    While I know the above comment is not from the Real Bjarne Stroustrup, I do agree that C/C++ will be there for quite some time into the future. The language will evolve and become more powerful, but it’s not going to decline anytime soon.

  84. Comment by Eric | 2010/08/27 at 17:58:06

    It seems to me that C++ has actually been on the decline for quite some time. I’ve been laid off a few times in the past few years, and looking at job postings for software developers, C++ seems to be a skill that’s rarely sought these days. The most common programming languages & technologies that companies seem to be looking for are C#/.NET, Java, and web development languages (PHP, ASP.NET, and to a lesser extent, Ruby and Python). These days, C++ seems to be asked for in jobs that require maintaining legacy code (where perhaps they might want to migrate to something more recent like C#) and for embedded software development tasks.

  85. Comment by Vamp898 | 2010/08/27 at 18:12:52

    Sure does companies not look for C++ Developers. They want to develop Software fast as possible and cheap as possible to get a lot of money with it. Most Companys doesnt care a really bit about how good the software is in the end as long they make a lot of money with it.

    C, C++ is the mosed used Language in OpenSource Software and the most OpenSource Software is a lot better than there commercial counterpart…

    If i would be a company i also would use C#. Most companys develop for windows and most windows user who would by my software in the end would be not that clever and not care about memory/CPU usage at all. Especially with games.

    If the Software is to slow, windows users buy better hardware instead of use better software and thats what companys count for.

  86. Comment by Santosh Kumar | 2010/09/29 at 08:33:40

    I’ve been working in C and C++ since last 5 yrs. I also did some coding on .NET using c#, although I didn’t know C# at all. But I’ve a doubt if reverse is true.

    Also, when I interview a .NET guy and I ask them to write a program to sort an array, or to swap the values of two integer variables, they look for a method provided by library. When I insist to write their own method, believe me, they have a very hard time writing a simple swap program.

    .NET is a good library I believe, but why is it making programmers dumber! I have no clue!

  87. Comment by Rhonald moses | 2010/09/29 at 08:50:39

    What Santhosh Kumar says is very true. I’ve come across lots of programmers who can’t think beyond what’s offered.

    While it’s good there are numerous libraries to make task easier, it shouldn’t make encourage dump programming.

  88. Comment by cppKoder | 2010/12/07 at 19:42:53

    use C#. you know why? becase .NET made it easy for ignorant people

  89. jo
    Comment by jo | 2011/02/18 at 07:38:00

    i realize this article is very old but i thought i would give a recommendation on a newer book

    introducing visual c# 2010. published by apress.

    its not as dry as most programming manuals, it covers everything needed to write programs in c#, and what it doesnt cover in detail it recommends books dedicated to those topics

  90. Comment by Dean | 2011/02/19 at 07:49:35

    I find this discussion both interesting and amusing. I am a mainframe assembler programmer, looking for a good choice of language to start my 11 year old son who wants to write some simple games. As I scroll down the discussions, I see people talking about stupid programmers needing to have the language limit them, perform cleanup tasks for them, or provide simple interfaces to complex functions and services at the cost of performance.

    And yet, these same people would scoff at using assembly language even though one could make the exact same argument. Portability? I think not – too many proprietary extensions and special libraries in various compilers for that to be a reality.

    The real issue is time to produce a usable product. That’s it and that’s all. If you already know C++, that’s what you will use. If you already know Java, that’s what you will use. If you already know assembler, that’s what you will use. If you don’t really know any language well, you will use the one that gets you up to speed quickly to produce something that you can get paid for. :-).

    Still, an interesting discussion with useful information. Thanks!

  91. Comment by nick | 2011/02/21 at 17:30:05

    Some of the points in your argument are redundant..
    how the main func is treated is compiler and platfom dependant.
    and a few of your c# pro’s can be seen as con’s in various situations

  92. Comment by Vamp898 | 2011/02/21 at 20:18:17

    Is there already an real world Programm in C# which is faster than its C++ part?

    C# Programmers say, since the language exists, it can be faster than C++ and over all is the best language at all.

    But im waiting since years and did not seen any single application. I know some C# applicatinos which got re-written in C, C++ or Vala (Vala have C# Syntax, but the compiler translates everything into C-Code before compiling it) in case of beeing much faster than, but i never seen a C/C++ Application which got rewritten in C# in case of beeing faster.

    How can this be? Is no C# Programmer on this planet interested in making applications faster?

  93. Comment by Bassam Alugili | 2011/04/05 at 09:45:50

    I think each programming language contains a treasure. Sometimes I can do something in few minutes in C# and If I do the same thing in Java or in C++ I need hours or days. same here for C++.

    for example:
    It took me about 2 days to draw half transparent movable icons on the windows desktop because the calling of Win32 DLL draw rectangle in C# with P/Invoke dosn’t working correctly for a reason.

    I did the same appliction in half hour with C++.

  94. KE
    Comment by KE | 2011/04/12 at 10:56:20

    ‘ll find that the restrictions imposed by C# can be quite limiting.

    MI can be dangerous if used incorrectly – In my experience tho, good c++ programmers know excatly how to use MI such that MI becomes a real benefit over non MI mechanisms.

    Pointers are mind blowing in power when you really know how to use them. Try using auto semantics on pointers when using them so that cleanup will be automatic if normal intent has failed.

    Threads may not be well supported in C++, but you can develop a framework that supports multi-threaded development very well. I’ve written my own, and find it invaluable in nearly all situations. It is beyond amazing how one can solve certain issues “simply” by using a MT approach (especially if your MT techniques produce constant stability and high performance).

    I intend releasing this framework to the c++ community this year or early in next. I’ve personally shut up our whole c# dept at my work with c++ solutions that out perform any c# variant by 100s of times in scalabity and performance – and I took far less time (one out) developing my solution against teams of 6-7 C# developers.

    When VB & Delphi hit the scene, all the weak developers huddled around it and said that they were going to replace c++. c++ is still here, and now all those weak devs have huddled around java & c# saying the same thing as last time.

  95. Comment by Smoke | 2011/08/13 at 17:51:31

    First off, all you C++ guys claiming C++ is faster, only in rare situations, or because you FAIL at C#. (You see, you can’t program in C# like it’s C++, and that’s what most of you try to do.)

    In many cases, C# is much faster, there are various websites that have done benchmarking on this subject, and where C++ wins, it’s by marginal numbers that only the most anal would even care about. (Or worse, the code was written by some C++ coder, C# noob, yeah, great comparison, you’ve 30+ years experience with C++, one day with C#, I wonder why the C++ code was faster in your test….)

    As for calling us weak, I program in C++ too, I just have the intelligence to realize it sucks. (I only use C++ when doing injection on pure C++ applications. You can do some of it, heck even most all of it from C#, but this is one case where it’s just easier to use C++.)

    And yes, C++ is being replaced, the REASON it’s still here, is because of idiots clinging to a sinking ship, meanwhile, in the real world most every company has switched to C#. (With a few exceptions having nothing to do with C++ being better. More to do with money, ie, development cost, retraining employees on new software, etc, etc,.)

    In the game industry, not really sure, probably just too risky of a proposition at this point in time. (ie, Fear of spending huge sums of money developing with a relatively untested language.(The same happened to C++ when it first came out, old C programmers stuck to C))

    Though, I do know Force Unleashed used SlimDX, which is a managed DirectX library, so, it must have at least taken advantage of C++\CLI, etc,.

    The point is, the move is happening, and more and more ppl are going that way, sooner or later, C++’ time is up. (Honestly, minus .Net features in C++\CLI, what can it do that .Net can’t? Some little tricks with pointers, that can be better accomplished a million other ways? Seriously, try Action\Func, you can do CRAZY stuff with those, they are so flexible it’s unreal. Especially combined with LINQ, and Generics, etc,.)

    The only thing I can think of, is inline __asm, which is useful for hacking, and I suppose making faster routines where needed. That’s about it.

    As for the lack of procedural functions. So what?

    using System;
    using …..

    public static class MyHelpers
    {
    public static void MyFunction() {}
    }

    vs.

    #include “stdafx.h”
    #include …….

    static void MyFunction(){}

    Is that really a big deal to C++ users? If you say so…

  96. Comment by Eric | 2011/08/13 at 18:01:35

    Yes, C# is a good language, and I very much enjoy programming in it. Even as a long-time C++ developer, I wouldn’t mind developing primarily in C#.

    Smoke: I am skeptical about your claim about C# being much faster than C++ though. It may be faster in some ways (for example, due to delayed garbage collection), but like Java, it runs in a virtual machine – basically an emulated environment. How is it that an app running in a virtual machine will be much faster than a native app?

    I do wish C++ had some of the same libraries that .NET does though.. .NET’s libraries give you so much that you can leverage; it’s really nice to work with.

  97. Comment by Smoke | 2011/08/14 at 00:20:15

    Here is one source..

    http://www.grimes.demon.co.uk/dotnet/man_unman.htm

    There are also several topics on StackOverflow on the subject. (Most experts agree, C# can be faster in a number of cases, while C++ can be faster in others. Never said it was always faster.)

    As for the virtual environment, as far as I know, it get’s compiled to IL, executed by the JIT compiler as native code at runtime. (Read: Likely as ASM directly on the CPU, etc,.) Which, means it’s not exactly running in a virtual machine, as soon as you run it, it’s compiled into native code, and executed as native code.

    Which contradicts most arguments on this matter. (ie, C++ > C#, C# > C++, etc,. They should technically be equivalent, but, memory management, and other factors probably come into play.)

    C\C++ is very old, and very well optimized(which probably explains where it does beat C#), C# is new, and still getting worked on, and improved every year, I say give it another few releases, and that speed difference is going to start fading away completely.

    Regardless, I like it, it get’s the job done, I’ve never seen a noticeable enough difference to warrant using C++, and as mentioned, I only use C++ for injection these days. (I’ve written games 2d\3d, compilers, particle engines, you name it, under C#, it’s always delivered.)

  98. Comment by Steve | 2011/08/14 at 01:44:21

    C# can never be faster than C++. It’s a nonsensical statement. C is the foundation of both but you cannot get at the C from C#, but you can from C. The value of C# is speed of development not execution.

    In any case, Its an academic argument. Microsoft is on the decline and C# will go down with it. C# has not value outside the msft environment. It will not even be a footnote in the history of programming 10 years from now.

  99. Tom
    Comment by Tom | 2011/08/14 at 02:04:08

    I’m assuming you’re not aware of this, but C# isn’t an interpreted language. It gets compiled to native machine language upon execution. Granted this means your startup time will be several hundred milliseconds longer, but for many scenarios, it’s worth the trade-off.

    So, contrary to your beliefs, it’s entirely possible (likely even) that C# can be every bit as fast as C.

  100. Comment by Eric | 2011/08/14 at 02:18:51

    Steve: There is a project called Mono which provides a C# compiler and .NET runtime libraries for Linux and OS X. So if Microsoft does go down, there’s a chance that C# will survive.

    Tom: A C# application doesn’t get compiled down to the machine’s native code. It’s compiled down to a bytecode, an intermediate language code runs within the .NET runtime.

    Smoke says it’s compiled via a JIT compiler, so it should still be fairly fast.

  101. Tom
    Comment by Tom | 2011/08/14 at 02:28:05

    The C# compiler compiles C# source into bytecode. The VM compiles the bytecode to native machine language at runtime. There is no interpretation.

  102. Comment by Steve | 2011/08/14 at 03:27:47

    Yep. Aware. Stand by my statements. Have you guys ever written a compiler? Do you think the C# compiler is written in C#? More specifically, do you think the C# memory management system is written in C#? If so, educate me on how that’s possible.

  103. Comment by Smoke | 2011/08/15 at 14:36:44

    Almost everything in .Net is built with itself. (ie, as soon as the core elements were created, they started using the runtime to build itself.) As mentioned, it’s compiled to byte code by the IDE, then compiled at runtime to native instructions by the JIT compiler.

    That’s your answer to how it’s possible. Native code. (This is no different than C\C++, it get’s compiled to assembly\machine code, then executed just the same. Which is why C# is better, it’s the same damn thing, only with better syntax, better libraries, faster development times, etc, etc,.)

    .Net uses the CodeDom compiler which is written in .Net. (You can use this yourself to allow for dynamic code creation. See: LinqPad, it likely uses this technique, it’s website kinda sucks(hard to tell what it does.), but it let’s you execute code snippets directly from a textbox.)

  104. Comment by Smoke | 2011/08/16 at 20:40:14

    std::vector::size_type size;
    size = Commands.size();
    std::stringstream ss;
    ss <> output;
    DebugPrintC((char*)output.c_str());

    This kinda crap is a major reason why I dislike C++… WTF is that?

    Yeah, give me a ToString() method any day of the week, it took me like ten minutes to figure out how to print the size of an array, real productive language. :roll:

    The C# equivalent would be..

    DebugPrint(Commands.Count.ToString());

    There may be a better way to do that in C++, however, the point is, it’s not obvious, it takes research to do simple stuff, and waste development time.

    Most of all, it just p*sses me off.

    Why isn’t vector.size already wrapped to a standard type like int, etc,. ?

    It should figure out internally what the hell it contains(it’s declared with a type), and how many, then give me a straight answer. Why all the hoops?

    C++ has the most idiotic implementations.

  105. Comment by Smoke | 2011/08/16 at 20:42:14


    std::vector::size_type size;
    size = Commands.size();
    std::stringstream ss;
    ss < < size;
    std::string output;
    ss >> output;
    DebugPrintC((char*)output.c_str());

    Here is that C++ again, the forum ate it, if it eats it again, tough…

  106. Comment by Smoke | 2011/08/16 at 20:44:52

    Your code tags are seriously f*cked up..

    I’m sure most of you can guess at what the code is supposed to be though, it uses stringstream, etc,.

  107. Comment by Eric | 2011/08/18 at 06:24:16

    I don’t think that C++ code is that bad, really..

    And a couple things:
    1. C++ lets you declare & assign variables on the same line; and you don’t even need to scope the variable type – you can also use size_t. So your size variable could be done like this:
    size_t size = Commands.size();

    2. is not an operator in C++. The correct form would be this:
    ss << output;

    By the way, vector.size() does return a standard type. Even though the real type is hidden from you, it usually returns an unsigned int.

    I think the only thing that looks a little strange there is having to do things like this:
    DebugPrintC((char*)output.c_str());

    But you just have to know the language. Someone who doesn’t know C# well has to do research, just like someone who doesn’t know C++ well has do do research, as you say.

  108. Comment by Dreamship | 2011/08/22 at 23:33:16

    I guess I’ll throw in my 2 cents. I programmed C++ for many years and based what became a $35 million company on C++ code. I was never a student of the C++ language–I guess I knew a lot about it because I personally wrote around a million lines of code in it. But I was not what so many of you clearly are–students and experts on the language itself. After I sold my company, I went to law school and have just taken the bar exam. I’m currently planning a project in conjunction with one of the world’s foremost experts on legal writing to create some add-ons for Word to do real grammar checking, add authoritative English usage references, and create built-in citation tools for lawyers. Because of this, I’ve spent the last few months updating my programming skills. I won’t do any of the programming myself, but I will do the design work and I must decide what language platform to use so I can begin to hire the right people. I’ve pretty much decided on C# for a number of reasons. Ruling out VB was easy. It’s just too shoe-horned. Deciding between C++ and C# was a bit harder but I think C# wins the day. Here are my thoughts on why.

    I can tell you that the bane of my existence for 20 years was memory allocation. Yes, C++ now has garbage collectors, but it seems risky to depend on a third-party add-on. Pointers came in second place as creating the most code gremlins. I can’t begin to tell you how many hours me and my team spent tracking down runaway pointers. Multiple inheritance? Never used it–didn’t need it. Somehow, we managed to put together an extremely complex production application that, to this day, processes 1,000,000 medical claims each day without ever giving a second thought to multiple inheritance. Templates and STL came in third place as the cause of our issues. We finally spent an entire summer eliminating STL from our code and our system lost 75% of its compiled size and half its bugs.

  109. Comment by Eric | 2011/08/23 at 01:17:58

    Dreamship: I think what you’ve said makes sense. What it all comes down to is using the best tool for the job, or what you feel is the best tool that will get your job done.

    I find it interesting that moving away from the STL got rid of so many of your bugs though. What did you use instead of STL? Your only other options are re-inventing the wheel or using a 3rd-party library, which like you said, could introduce more bugs.

    Rather than re-inventing the wheel, using the STL should keep bugs low because the STL is a tried and tested library. I think the STL is very powerful and well-designed, too. When I program in a language other than C++, I sometimes find myself missing the STL.

  110. Comment by Dreamship | 2011/08/23 at 01:21:51

    I probably should have been more clear–STL wasn’t the problem, it was the loose nuts behind the wheel. It’s hard to get good help these days. :wink:

    The more competent programmers had no problem with it. Not so much for the less competent ones. And yes, we did have to reinvent the wheel (or wheels)–but it was a very particular set of wheels tailor made for our problem domain and the types of issues we had.

  111. Comment by Smoke | 2011/08/23 at 12:33:28

    @Eric,

    You realize you’re analyzing\dissecting code I wrote in like five seconds, right? (As I said, I spent like ten minutes trying to guess how it worked, and when all logic failed, I looked it up, Google pointed me at the MSDN, and that was more or less the code they supplied.)

    So no, it probably wasn’t the BESTest implementation EVER! However, it wasn’t meant to be, nor was it a display of my C++ coding skills.

    It was however a display of how I had to go from vector to size_type to string back to char* just to accomplish what should have taken one line of code. (And does, in C#.)

    Also, I made it pretty clear that the forum butchered my code, for example, the “incorrect” operator was in fact, VERY correct, until the forum mangled it. ;)

    And, yes, I don’t know C++ very well, which is why I said it could probably be done better, etc,.

    As for learning the language, etc,. Sigh.. I don’t have the energy to get into this, but, no, I know enough to know C++ can’t compete with C#. (I gave C++ a fair chance, I don’t randomly hate things, nor was I born that way. It earned my contempt.)

  112. Comment by Steve | 2011/08/23 at 19:02:18

    @Smoke

    “And, yes, I don’t know C++ very well, which is why I said it could probably be done better, etc,. ”

    At least you are honest. You get points for that, but your original premise is not only wrong its preposterous. Clearly you don’t understand languages, compilers, runtimes, etc. Its a dying art for sure, but its still amazing how fast context is lost and faulty foundations of logic are erected.

  113. Comment by Smoke | 2011/08/26 at 02:25:04

    @Steve, you gotta be more specific than that. Broad response.

    Languages: These are just tools for us, the programmer.

    If you asked me to write you a program to database your movie collection, and I gave you back the most confounding, horribly designed tool, EVER.

    What would you call that tool, even if the tool does in fact do what you asked, it’s just put together in a nonsensical manner?

    Well, that’s C++, it’s a powerful tool, it does it’s job, but, it’s put together in a way that makes little sense. I’ve learned both languages, I stuck with C#, ditched C++, because it was put together by drunken chimps, the best I can tell.

    Many ppl agree with this, the numbers speak for themselves, there are more amateur programmers than ever because languages like C# have made programming more accessible to the average user.

    Compilers: I don’t understand these, funny, I’ve been working on one for a custom language for a couple of weeks now.

    Runtimes: What does this have to do with anything? I understand the .Net runtime, if that’s what we’re talking about do you? Apparently not, or we wouldn’t be arguing.

  114. Comment by Eric | 2011/08/26 at 03:56:40

    Smoke – I’m sure C++ made a lot of sense at the time it was made. Design decisions for programming languages evolve over time. C++ was made to support a wide variety of programming styles – the idea is not to limit the developer to a particular style; therefore, C++ supports both functional and object-oriented software development, multiple inheritance, direct access to memory (AKA manual memory management), etc.. So while C++ may appear nonsensical or overly complex to some, there are reasons behind the design decisions of C++.

    I like C#, but one thing I do like about C++ is that it is a fairly universal language, due partly to how long it has been around. It’s fairly easy to find a C++ compiler for any platform. Also, just about any other language can interface with modules written in C++ (or at least C). That’s not necessarily true for other languages. Is it possible to make use of a .NET library from Perl, for instance? I’m not sure.

  115. Comment by Smoke | 2011/09/03 at 16:55:34

    The design of C++ is flexible, etc, but most of that’s possible, or not necessary in .Net. (The only real issue is multiple inheritance, which is easily solved in most cases by chaining abstract classes, or using interfaces, etc,.)

    As for being cross-platform, why would you be? People need to knock it off and join the other 95% of the PC market on Windows. (And if not, there’s always Mono.) (As for C# from Perl, maybe, but why would you? Either rewrite your code in C#, or stick with Perl.. Also, assuming it’s not possible, the problem would be Perl, .Net can be used anywhere it’s supported.)

    C# has many great features that are overlooked.

    You can convert any .Net language to any .Net language, easily, and it can be automated. (There are many online converters(VB.Net -> C# or C# -> VB.Net), those are built using .Net capabilities.)

    Most everything in .Net is accessible, and usable, ie, you can even access the compiler stuff, to easily create a compiler, try writing a C++ app capable of compiling, and error checking C++ code accurately. (You can do it easily from C#, look up CodeDom, and examine what it’s capable of. Paint.Net uses this feature in a plugin which allows you to create Paint.Net plugins. ie, using a C# plugin for a C# application, to create C# plugins, for the C# application. :P)

    Most the stuff in Boost is included in C# by default. (It’s likely in there, if ya dig around a bit, ie, Google, etc,.)

    The way C# handles dependencies alone, is superior to C++, and much easier to deal with, especially with complex source code containing various projects, each having various dependencies. (I was dealing with this earlier, I downloaded some C++ source, and the upgrade wizard broke half the settings, so I spent a long time fixing linker errors, etc,. Not a real issue in C#, but a huge PITA in C++, I’ve had projects so broken, I threw em’ away, and I know they worked at some time, under some version of VC++, etc,.)

    Reflection is one of the better features, you can reconstruct code by simply reflecting into the .exe\.dll file. (I recently recovered source code I had lost by using .Net Reflector on an .exe file I had uploaded somewhere. That program has went from freeware to paid, however, free alternatives are being created. And you can do this yourself using reflection directly from .Net, it’s just more work than using a pre-made tool.)

    That’s just the tip of what of reflection can accomplish, btw.

    I could go on, but those features alone should make it clear that .Net is a serious contender.

  116. Comment by Eric | 2011/09/03 at 19:13:01

    Often, instead of thinking “why would you want to do that?”, I often like to think “why not?” Such is the case with being cross-platform. Why not? And I doubt your argument that 95% of computers are Windows machines. These days, I think it’s lower than that. Lately I’ve been seeing more and more people using Apple’s OS X (although that still probably amounts to just 10% of the market at most), and I know of people who use Linux too. So I’d guess that Windows probably makes up maybe 90% or even 85% of the computer market these days, at least in the US.

    A company may or may not decide whether it’s worth the time, effort, and expense to capture the part of the computer market not using Windows. But in general, I think it’s worthwhile to think about making software cross-platform, especially for brand-new projects where it’s easier to plan for such things. If you can make an application work on Windows, OS X, and Linux, why not? Your software will be accessible to even more people that way.

  117. Comment by Smoke | 2011/09/05 at 15:50:25

    As for my “knocking it off” comment, that is of course my opinion.

    As I said, Mono allows for .Net to run on other platforms, I believe Linux, and possibly Mac, not sure on the Mac bit, but I do know it allows .Net to work cross-platform. (ie, .Net can be made to work on whatever platform, MS simply isn’t leading the charge, likely because they don’t want to support their competitors.)

    While being able to do this is, I suppose nice, it’s not really necessary.

    A good percentage of that 10% is composed of idiots who simply couldn’t work Windows without breaking it. The rest are just MS haters, who loathe anything, and everything MS.

    That again, is probably more opinion than hard fact, but, it’s based heavily on interactions with those users, they’ve never sold me on using those OS’s, and my personal experience with Linux\Mac were less than spectacular. (More along the lines, of “meh”..)

    All that aside, C# is very new, as time goes on it will become more accessible from various platforms. (C# is around 10 years old, but it’s only come into common use in the last 5 years or so.)

    Regardless, I guarantee you .Net is the future, C# is just an interface, so, whether it’s C#\F#, or even C++\CLI, you can bet .Net is going to be around for awhile, and eventually dominate the market, mark my words, burn them deep into your memory, and give this post a look back in 5-10 years, and tell me I’m wrong then.

  118. Comment by Eric | 2011/09/05 at 19:46:57

    I’m a longtime Windows user, but I’ve seen a similar extreme in the Microsoft camp too – I’ve seen people who love anything Microsoft makes and eat it all up, and dismiss Apple and loathe Macs (and to a lesser extent, loathe Linux as well). It’s a belief that anything Microsoft does is the right way, and is the only way to do things. I’ve also heard from people who say they don’t trust Linux because they (mistakenly) believe that since Linux is open-source, anyone can get into the source code and potentially put in a virus or other malicious code. A misinformed conclusion, unfortunately.

    I’m fairly computer-agnostic.. As a computer geek, I pretty much like everything. After using Windows for a long time, I tend to find myself interested in other operating systems and platforms, at least to see different ways of doing things.

    from a software development standpoint, if you were to think of it from the perspective of a software company, would you really want to ignore a whole segment of the market because you think its users are idiots? That wouldn’t be a good way to do business. If you are selling your software, it would certainly be of value to you to tap into markets that could potentially bring in significant revenue.

  119. Comment by Smoke | 2011/09/06 at 05:46:31

    I wasn’t talking about that kind of idiot, I meant the higher tier ones, who don’t try making toast in their DVD drives, etc,. :P (I don’t even factor these ppl into the equation, as they likely couldn’t use anything I developed anyways, unless the GUI consisted solely of two buttons, a big green “Start” button, and big red “Stop” button.)

    Of course you are correct, there are plenty of idiots using Windows, but, it’s user base does consist of the majority the planet, so, yeah…

    From a developers point of view, that’s exactly what happens, very few professional developers support those OS’s, and when they do, it generally means it will run via the emulation options those OS’s have. (Most games are like this, very few AAA titles have native cross-platform support.)

    I’m not trying to leave anyone out, I develop for Windows, they are free to use Windows, and my programs.

    The main issue here, is that I’m not going to make my program harder to develop, or more complex for the sake of a few ppl, 10% may be a lot in terms of the worlds PC market, but not all of them are going to use my product, even if it were compatible, so why make more work for myself, and risk introducing issues into my program when at best I’d get 1-3% to use my application if I were lucky?

    It would be one thing if I were on Linux, and made my apps Windows compatible, because then, I’m reaching a larger audience, etc,. (And it’s only right since I’m the one using the oddball setup in that scenario.)

    But, going out of my way to reach a few more ppl is hardly worth the effort. (Especially when they have methods of running Windows apps already available to them. I know for a fact I have ppl running my C# apps under Linux using Wine, not sure about Mac.)

    (In my eyes, ppl using Linux\Mac, are kinda like ppl that still ride those old style bicycles with the huge front tire. An oddity, or a rarity, if ya will, and I’m certainly not going to start selling big bike tires at my bike shop if ya catch my meaning.)

  120. Comment by Vamp898 | 2011/09/14 at 14:23:53

    First, please ingore any misstypes or spelling errors, im a bit in rage^^

    @Smoke

    “make my program harder to develop, or more complex for the sake of a few ppl,”

    Thats just plenty stupid, with a good Framework on C++ (like Qt with KDElibs) you need _MUCH_ less code than in C# with .NET.

    But i bet you never used KDElibs because you’re a Windows guy so you think its complicated to use C++ and so you see no sense to try new things.

    For me you are like those guys who use this old bicyles with a huge frong-wheel.

    Your last sentence was not needed at all.

    I dont like such type of comments. KDE makes a lot of new awesome stuff, Linux had the first desktop with 3D Effeckts, KDE was the first Desktop with Widgets (SuperKaramba back in KDE3 times)!!! (not Mac OS X) and so on.

    Other DEs copy that stuff and than those are the cool one and Linux Stuff is old shool because because they only think on a console when they think about Linux stuff.

    They same with C#. People dont talk about the Language C#, you dont even care about the Language C#. people only care about .NET which makes possible to write applications without a lot of programming knowledge.

    But! Using Frameworks is nothing bad, C#/.NET People are right, why re-implement the weel.

    Stop!

    Learning how to do programming is not re-inventing the weel! It is called learning and you cant say “Why learn if other learned for me and i just can use there stuff”.

    This way you will not learn! So learning is _not_ re-inventing the weel.

    If you learned there are tons of Frameworks, for example Qt which can handle nearly everything with just some lines of code.

    I doubt that you need more code in C++ with Qt than with C# and .NET

    People dont compare C# with C++, they compare the .NET Framework with the Standard C Library which is useless and stupid.

    If you want to compare C# with C++ you have to use the same framework on both.

    The GNOME Project did it with GTK+/Mono. They just said, we use GTK+ on C# and on C, what was the result?

    The only advantage of C# is the easy syntax, so they created Vala

    A programming language with C# syntax which translates into C while compiling and gets compiled by GCC

    Why did they do that? Because they dont need .NET and that is what C# people telll about. Without .NET there is no need for C# because C# isn’t the best language at all. The only advantage (as i told) was the syntax and a meta-compiler for C is better than investing the time to implement a C# Runtime with Framework when they use GTK+ anyway (which is better in there oppinion).

    Also if you create Desktop Applications there are things like KDElibs which makes it so awesome fast to create a Desktop Application.

    With 20 Lines of C++ Code you could create an File-Browser which can handle Webpages using WebKit, all features of Folder Viewing (using Dolphin KPart), open PDF Documents (using Okular KPart) opening Archives (Ark KPart) and so on.

    Qt + KDElibs = you can’t save more time while programming

    You have much less Code than in C#/.NET and the applications have a significant speed improvement

    So the Framework decides how easy it is to write applications, not the language itself. So the whole compare C/C++ vs. C# is useless at all, we mostly talk about the framework.

    And KDElibs with a very lot of KDE Applications (like the GNOME stuff) works on Windows because they follow official Standards.

    If all people would follow official standards we would be at a very high level of programming applications and would have so many awesome stuff, but Companys like Microsoft want money, not good software.

    They say “Good Software is something you _have to do_ to get Money, nothing you do at your own will. We release now because now we can make the most money with a release. No we delay the release because we can get more money when we delay”

    Linux Community Says “I want to do good software because it is my pleasure and i give it for free to do other a pleasure. I give every release as soon i have finished it so people have the brand new stuff as fast as possible to bring it even more forward”

    And to talk about those people like “ride those old style bicycles with the huge front tire.” while programming for an OS of a company which does exactly that because you can make most money if you are the only one who creates bycicles is just absurd.

    Stop bashing about people who are inventing new stuff while programming for an OS from an company who just steals that stuff and re-invents it to make money.

    Also i think its absurd that todays desktop gets more and more like “2 Buttons are 2 Buttons to many”.

    I know that most people use microsoft and because most people on earth cant use a computer microsoft makes there os more and more function less.

    That way people with knowledge go to linux and people with knowledge prefeer a console with functions than a gui without functions. That doesnt have anything to do with old shool. Those people just want and need functions.

    Im always suprised how people say “wow! that was so awesome” when i used a single command to resize 100 pictures, rename them and create a HTML Gallery which gets uploaded to my FTP Server.

    With just one command. They say “i would need 5 Applications and a hour to do that” and i say “Yes… Windows…, more gui, less function”. But Linux also have all the GUI Stuff and you can do the same thing today with 2-3 Clicks (still even much faster than every existing way on windows) in case of the advantage of the CLI goes into the GUI.

    Anyway, Microsoft is the reason why user-friendly linux systems needs a console at all, without the restrictions and illegal activities (recorded on wikipedia and so on) there would be no stones in the way of user friendly linux distros so no need for CLI for the sutpid users.

    So Microsoft want that Linux stays old shool and even while this big company works against it, Linux invented a Desktop with Widgets, 3D Desktops and the most feature rich Desktop Environment in World (KDE). Nearly everything which exsits on the Windows DE was on KDE before.

    I think you should rather adore the Linux Community for there respect and there will to fight against restrictions and to give there software as a gift for free than thinking of them as concurrent (they dont sell anything, how can they be a concurrent ?!?) and make fun of them that they struggle with consoles on user friendly systems in case of Microsoft makes them hard as possible.

    You dont have any respect for real work of people who give there hard work away for free while working for a company which wants to distroy that to get more money, than you just make me sick.

    “they are free to use Windows” they are not. Microsoft gives a lot of money that people are _forced_ to use Windows, they are not free to use Windows so they are not free to use your applications. They have to pay for Windows and so get all the restrictions just to be able to use your software.

    At least comment i want to say.

    A MS Programmer told me “Developers prefeer Windows because you write an application for windows and you can be sure it will work on the future because its not opensource and suddenly everything is different”

    Sim City 3000 was released for Linux 2.4 (were on Linux 3.0.3 right now) and Windows 98.

    Sim City 3000 doesnt worked well on Windows XP and on Vista/7 it doesnt work in anyway.

    Sim City 3000 works on Linux 3.0.3 without problems.

    So on Linux it is so more easy to write applications in case of good standards and good code base (KDElibs, Qt, GTK+ and so on) than on windows (in addition you can be sure it will work in future too). So writing applications on Windows is much harder (try to port Windows DE to Linux, no chance, KDE and GNOME can be ported easily to windows and partly have already been ported

  121. Comment by Narre | 2011/10/10 at 05:29:33

    Vamp, you’re amazing. You’ve told everything there is to say. I couldn’t agree more.

    This topic is useless as it’s very closed inside a huge box they don’t even know how to get out.

  122. Ken
    Comment by Ken | 2011/12/06 at 23:02:54

    I have just learned C# a few weeks ago and as my first project I refactored an existing C# program written in a typical OOP “style” (using numerous objects, classes, repetetive code within case statements etc). After my refactoring it runs 166 times faster and uses less than 50% of the original source code. If I was able to re-write it in an Assembler I would expect it to run about 300 times faster and be perhaps 5-10 times physically smaller. It would also have far LESS source lines, vastly more code interrelationships (i.e where code and data definitions automatically adjusts itself depending upon other parts of the code). High level languages are supposed to make programming easier, not harder!

    I particularly cannot understand:-

    1) Why C# doesn’t have a powerful conditional source code preprocessor/macro feature (other than basic #debug)
    2) Why it cannot utilize procedural sub-routines (to reduce repetetive coding)
    3) Why enum requires a cast to Int.
    4) Why it doesn’t use EQ instead of “==” for comparisons
    5) Why it had to use the OOP paradigm at all (it is now being discredited at long last after years of programmer confusion).
    6) Why it doesn’t support pointers by choice (buffer overflow can be automatically checked in an interpreted/ CIL environment if designed correctly)

  123. Comment by Smoke | 2012/01/18 at 09:21:19

    @vamp,

    “Thats just plenty stupid, with a good Framework on C++ (like Qt with KDElibs) you need _MUCH_ less code than in C# with .NET.”

    Umm, no, the .Net framework is very compact, and well optimized. You talk about using libs on top of C++, but that is MORE code, sure, the lib makes it easier to use, but, it comes with more overhead(more code), the .Net framework alleviates this by being well\smartly coded from the ground up. (ie, You get all that power, and ease of use, with way less code than any C++\Lib combo, because it’s not an add-on, it’s the frameworks design.)

    “But i bet you never used KDElibs because you’re a Windows guy so you think its complicated to use C++ and so you see no sense to try new things.”

    The majority of Windows based applications are written in C++, for, oh, the last 20+ years.. (Windows guy? Are you high? Windows has been dominated by C++ for years.)

    As for me, I CAN use C++, I choose not to, because it takes ten times as long to accomplish the same thing. (Hmm, do I spend ten months developing my app, or a single month, decisions, decisions…)

    “Stop bashing about people who are inventing new stuff while programming for an OS from an company who just steals that stuff and re-invents it to make money.”

    First off, f*ck Linux, here’s why, I can call MS, and raise hell if something goes wrong, I can make them address my issues, try that with the Linux community, and you’ll get banned from whatever forum you posted on. (Sure it’s free, but, that also means they have no obligations to help me, or to put up with my complaints, MS does.)

    Steals stuff, and re-invents it to make money? You mean, like EVERY SINGLE F*CKING COMPANY ON EARTH!!! How many brands of cars are there, toilet paper, TV’s, etc, etc,. That’s all everyone does in the business world, that IS business, sorry, Komrade, we’re capitalist, it’s what we do.

    I’m sure you work, do you do it for free, NO, you have bills to pay, and so do they, how about all the jobs Linux is costing ppl? If everyone used Linux, and dropped Windows, that would put THOUSANDS of ppl out of work.

    “I think you should rather adore the Linux Community for there respect and there will to fight against restrictions and to give there software as a gift for free ”

    See above: This may seem great, but, MS charges, and in turns pays employees, they help create jobs, which helps our economy, Linux does not. (Hippy ideals don’t pay the bills.)

    “Sim City 3000 doesnt worked well on Windows XP and on Vista/7 it doesnt work in anyway.”

    Wrong, I’ve played Sim City 3000 on Windows 7, and XP, it does work…

    @Ken, really, you can write something in ASM and it’s faster? No sh*t sherlock, ASM creates the fastest code, faster than C\C++\C#, or anything else. HOWEVER, try developing a game like Doom 3 in pure ASM, and let me know how it works out for ya.

    Also, you rewrote your code to be more efficient, it was more efficient, and you blame the language? Okay….

    /walks away…

  124. Comment by Smoke | 2012/01/18 at 10:14:42

    @Ken, okay, you made me a bit mad earlier, but, I’ll bite, the facts are simple, you don’t know how to use the language.

    1) Why C# doesn’t have a powerful conditional source code preprocessor/macro feature (other than basic #debug)

    I’m fairly certain you can define your own directives, though, not really sure why you would need to, I’ve used C# for years, never needed to do this, for anything. (I’ve written compilers, game engines, you name it.)

    2) Why it cannot utilize procedural sub-routines (to reduce repetetive coding)

    You can, I think you want a static class, but, you can do much better than that in C#, once you know how to use it. (ie, Interfaces, Abstract classes, extension methods, good OOP in general, etc,.)

    3) Why enum requires a cast to Int.

    It doesn’t, you use enums directly, ie:

    public enum TestEnum
    {
    MyEnum
    }

    public void Func(TestEnum t)
    {
    t = TestEnum.MyEnum;
    }

    You can check them via int, you can check via string, or you can use them as described, C# enums do whatever you want them to.

    4) Why it doesn’t use EQ instead of “==” for comparisons

    Why would you want something so awful? /shudders

    (You can use “is”, for type comparision, ie, if (obj is MyType).)

    5) Why it had to use the OOP paradigm at all (it is now being discredited at long last after years of programmer confusion).

    No, it’s really not, not sure who your source is, but they are very wrong.

    6) Why it doesn’t support pointers by choice (buffer overflow can be automatically checked in an interpreted/ CIL environment if designed correctly)

    What? I think you want Action, or Func, but I honestly have no clue what you’re talking about. (It also has IntPtr which is a pointer type.)

    In any case, it’s no wonder your program sucked, read some tutorials, and try again.

  125. Comment by Smoke | 2012/01/18 at 10:20:03

    @Ken, btw, since you are new to C#, I should mention..

    public void Func(TestEnum t)
    {
    t = TestEnum.MyEnum;
    }

    This isn’t smart.. It was just a demo of how to populate the value.

    You would actually do this.

    class TestClass
    {
    private TestEnum m_value;

    public void Func(TestEnum t)
    {
    this.m_value = t;
    }
    }

    // Call it like this.
    Func(TestEnum.MyEnum);

  126. Comment by Eric | 2012/01/18 at 17:36:40

    “If everyone used Linux, and dropped Windows, that would put THOUSANDS of ppl out of work.”

    You could use that argument for just about anything. And what about all the companies that are building their solutions on Linux? For instance, IBM uses Linux for many of their solutions ( http://www-03.ibm.com/linux ); Google’s Android OS is based on Linux, and there many other examples..

  127. Comment by Smoke | 2012/01/19 at 01:35:24

    If it were a free model as Linux intended, and not a company selling software built off of Linux, then no jobs would be created.

    They happen to create jobs in this case due to the same ideals that drive MS, being employed by companies like IBM\Google, not on the account of anything Linux did by being freeware.

    I see no comparison between the two scenarios.

    Linux does not create jobs by being freeware, capitalism created the jobs, it was these other companies seeking to make profits that are responsible for that.

    I’m not against freeware, I release much of my work for free as well, but, until we live in a more ideal world, things are what they are.

  128. Comment by Vamp898 | 2012/01/19 at 13:59:43

    RedHat gets more than a billion $ per year only selling opensource software.

    Linus Torvalds gets enough money, the KDE Developers.

    If people can stay in there job is about _you_ if you pay for the software or not (or donate how it is called in the Linux world).

    What you are saying in the end is “If robbering is legal, no one on this planet would pay money”

    But back to programming languages.

    In the OpenSource World you´re not forced to use any langauge, you can choose whatever you like the most and whatever fits the most.

    Most Linux Software is written in C and C++, they have good and powerful frameworks and no reason to switch.

    But than Mono Came, the FLOSS .NET and CLR/CLI C# implementation.

    What happend? Some small projects where started in C#, a very lot of people worked on them and they have a very good and awesome clear sourcecode. But one thing happened, the software wasnt better. It wasn´t developed faster, it wasn´t developed noticable easier, but the runtime was faster and you had to install tons of librarys (its not like we already have enough).

    So in the OpenSource World, were nobody forces you to use any language, people hate C#. Not because its from microsoft, because it just dont have any advantage.

    People started to write clones of some C# Software in C++ and after some weeks the clone was finished with the same (or even more) features but much faster and much smaller.

    So the people started to think again? Do we have any advantage? Uhm yes, for very small projects (and only for them) the Syntax is easier.

    So what did they did? The created a whole new programming language called Vala. It have 99% of the C# syntax, so you can write as you ever wrote in C#, but the result gets converted to C and compiled by GCC.

    So you have the easy peasy syntax of C# and the speed and small memory amount of an application compiled by GCC.

    So right now in the OpenSource World, nobody wants or needs C# in any way, the KDE Project proven that a huge project with a million of source-code can be ported very easy and fast to Windows (they ported more than 100 applications, all written in C++).

    And why was porting that easy and that fast? We all thought that its hard and complicated, that is why CLR Languages exist or not?

    It is hard and compilicated if you dont keep the f****ng standards. If you think “Oh Mighty Bill Gates, i love you so much, why use POSIX when we have you!” than it is hard and complicated.

    A project with 2 Million lines of code and about 100 applications was able to port to Windows just like with a finger whip.

    If you can´t do that, that easy, you are just a bad programmer. So bad programmers need C#, the other wont have any problems with porting.

    Yes there are exceptions like hardware-near stuff, but anything else, there is no excuse. Windows even supports POSIX.

    And projects like Mozilla Firefox even use the GCC Compiler in a small GNU Environment to compile the Firefox EXE.

    The same with LibreOffice. A project with nearly 20 million lines of code, fully portable. Common, Java and C# are just bad excuses for bad programmers, but that is what industrie needs.

    OpenSource programmers wants to write good source-code using all standards and so on (just look at the source-code of the most active and mosed used open source applications, a dream (not all but most of them :P).

    Just take a look at the SourceCode of amarok with about 400k lines of code, really i want to get wet when i read this source-code.

    The opposite: Industry wants to make money as fast and as easy as possible. Software should not be “good” or “clean” or “well written using the aviable standards”, it should be finished as fast as possible and very easy to create to bring the most money with the less work.

    Now guess why C# and Java exists and now guess who are the real programmers ;)

    This here is no “C++ vs C#”, this here is “Real programmers vs industry programmers”

  129. Comment by Smoke | 2012/01/26 at 01:30:03

    Yeah, here’s some code from the “real” world, from these so called “real” programmers.


    ftImage print(640, 480); //This will store the string of text we print
    Sprite Text;

    print.setFont(fthenameofthefontinthedatafolder_ttf, thenameofthefontinthedatafolder_ttf_size);//Set the font we are using
    print.setSize(32);//Set the size of the font (should be a multiple of 4)
    print.setColor(Color::Color(255,40,40));//Set the color of the font in RGB format
    Text.SetPosition(100, 50);//Set the position of the starting point of the text we will print
    Text.SetImage(&print);//Append print as the image stored by Text
    print.printf(" Hellow World!\n");
    print.flush();//Tell the computer that the string of text is ready
    Text.Draw();//Render the text
    print.clear();//Clear the stored string of text
    print.reset();//Bring us back to the render starting point (defined by Text.SetPosisition())

    ———————–

    I’ve written a number of text rendering functions myself over the years, and I guarantee you, that not one of them, requires that much code to be used.

    Your boasting sounds good on paper, but, in reality, C++ code generally sucks, and is generally much more complicated to use than it ought to be.

    A text rendering function is ideally a one liner, anything more is ridiculous.

    (Btw, I’m fairly certain that this code was developed by a Linux user, so there goes your entire theory..)

    ——-

    In other words, you’re f*cking delusional, C++ produces just as many bad programmers, and just as much bad code, as any other programming language. (Linux\Windows, have nothing to do with it either..)

    Choosing a specific OS\language does not automatically make someone a better programmer, you’re either a good programmer, or you’re not.

    ——–

    Let me explain something else to you:

    I see the presented usage of a library, in the same way most ppl view a GUI in an application.

    Which is a fair comparison, when creating a library, you are creating a user interface, ie, some poor sap has to interface with your code, I think you’d do well to remember this.

    Anyways, ask yourself, given the code presented above, and a function with a prototype like this..

    void RenderText(params);

    Which would you honestly rather use?

    —-

    Personaly, I’m sick of having to type 20 lines to do something that should take one, I’m sick of re-inventing the wheel, because some assholes gave me a square and called it close enough, I’m sick of having to do other ppls jobs for them, because they fail at coding.

    And you know what, I encounter this problem with C++, more than any other language, which is funny considering how high mighty you guys think you are.

    As I said, there are good C++ programmers, and C++ can produce good code, however, that’s not an absolute, and more often than not it seems, it produces fail coders, who just think they’re good.

  130. Comment by Smoke | 2012/01/26 at 01:31:43

    Fix your f*cking HTML code tags….

    Here is the code again..

    ftImage print(640, 480); //This will store the string of text we print
    Sprite Text;

    print.setFont(fthenameofthefontinthedatafolder_ttf, thenameofthefontinthedatafolder_ttf_size);//Set the font we are using
    print.setSize(32);//Set the size of the font (should be a multiple of 4)
    print.setColor(Color::Color(255,40,40));//Set the color of the font in RGB format
    Text.SetPosition(100, 50);//Set the position of the starting point of the text we will print
    Text.SetImage(&print);//Append print as the image stored by Text
    print.printf(” Hellow World!\n”);
    print.flush();//Tell the computer that the string of text is ready
    Text.Draw();//Render the text
    print.clear();//Clear the stored string of text
    print.reset();//Bring us back to the render starting point (defined by Text.SetPosisition())

  131. Bob
    Comment by Bob | 2012/01/26 at 06:58:36

    In other words, you’re f*cking delusional, C++ produces just as many bad programmers, and just as much bad code, as any other programming language. (Linux\Windows, have nothing to do with it either..)
    ——————–

    This coming from someone who doesn’t use the proper slashes to mean “or”.. Normally you’d use / for that, not \.

    ——–
    And you know what, I encounter this problem with C++, more than any other language, which is funny considering how high mighty you guys think you are.

    As I said, there are good C++ programmers, and C++ can produce good code, however, that’s not an absolute, and more often than not it seems, it produces fail coders, who just think they’re good.
    ——–
    Regardless of the language, people who write bad code probably shouldn’t be producing software. Unfortunately, though, I’ve seen my fair share of people who get real software jobs who can’t seem to write decent code – even down to poor and inconsistent formatting, so that it’s hard to read.

    ————-
    I’m sick of re-inventing the wheel, because some assholes gave me a square and called it close enough
    ————
    The same may be said about C# in 10 to 15 years. I’m sure C++ and its STL, etc. was originally considered a rich library. At the time, it had what many people needed in a library to do common tasks. Now, many tasks that people do are different – but there are new libraries too. Just last year, the new C++0x standard was ratified, so now the Boost C++ libraries are part of the standard – Boost has some fairly nice stuff.

  132. Comment by Smoke | 2012/01/26 at 09:59:43

    “This coming from someone who doesn’t use the proper slashes to mean “or”.. Normally you’d use / for that, not \.”

    It’s just a delimiter to me, I leave it up the reader to figure it out based on context. :)

    Congrats though, you are the first person in nearly 15+ years of online activity to say a word about it. (I’m waiting for someone to call me on my abuse of “etc”, seriously, I use it a LOT.) :P

    “Regardless of the language, people who write bad code probably shouldn’t be producing software. Unfortunately, though, I’ve seen my fair share of people who get real software jobs who can’t seem to write decent code – even down to poor and inconsistent formatting, so that it’s hard to read.”

    No arguments here, that was my point as well, Vamp claimed that by nature, using C# made one a lesser programmer, I was pointing out that bad code, comes from bad programmers. (With C++ being one of the most used languages, obviously, it would suffer more, Java is another, and as you said, C#, as it becomes more popular. No language is immune, really.)

    “The same may be said about C# in 10 to 15 years. I’m sure C++ and its STL, etc. was originally considered a rich library. At the time, it had what many people needed in a library to do common tasks.”

    Again, no arguments, the longer C# stays around, the more the issues can compound, one bad lib, leads to another(a domino effect). But, the core libs are well coded, and have some good standards, so at least the majority of the problems should be confined to 3rd party libs. (Assuming MS doesn’t drop the ball on their end..)

    “Boost has some fairly nice stuff.”

    Yeah, I’ve used boost(not extensively, but..), it was one of the good C++ libs I was referring to, though, I still prefer the C# way, but that’s just my opinion, I prefer the verbosity of C#, and it’s generic system really suits my style of coding. (I really like how you can use generics with Linq, and lambdas, and get nice shortcuts, but still keep understandable code, everything can work together so cleanly and to great effect.)

    Regardless, I think we can agree, the problem is bad programmers, and in the case of C++, it’s heritage hurts it as well. (ie, it’s heavy use of shorthand naming(cout\printf), which was of course due to limitations in the hardware of the time, and bandwidth issues, etc,.)

    @All,

    In the end, use whatever language you prefer, but, use some standards, and think about your implementations, and how they’ll be used, and encapsulate\abstract wherever possible. (Also, pick some standards, and stick with them.)

    http://blogs.msdn.com/b/ericgu/archive/2004/01/19/60315.aspx#61480

    There is a .zip file, under the text “send me a link” it’s a hyperlink in the article, it contains a .pdf with one companies ideals of standards, I read through this myself, and found, I do nearly everything the same, though, we do disagree on a number of points, still, a decent list of standards to follow.

    You may also want to look into design patterns, I like interface\abstract class based designs myself(very extensible), I used to have a link to page with various design patterns that can be used for different scenarios, but I seem to have lost it..

  133. JB
    Comment by JB | 2012/01/29 at 12:58:12

    I am learning C# for the first time.I am on page 75. Chapt 5. to give you an Idea of my Experience. All of this is greek to me.,
    My point in commenting; I came here to see if I was better off Learning C# or C++ as I didnt want to invest much time on something only to realize **”OH SHI*, i cant build this with C#?, or a job doesnt want to hire me because I learned the wrong programming language.”

    Furthermore; your outline in comparison and the comments that followed painted a pretty good picture and helped build some confidence in me about studying C# over C++. But, I have a feeling I will be learning C++ in the future for some reason that isnt clear to me now. (popularity, History etc…)

    My interest would be to create games(like eq2)(programming with gui programs that assist with creating games like UNITY3d platforms) and Other Business type applications in the future.
    Also, Windows application that would be similar to allow users to clear out the SAM file on windows because an ex employee changed the server password. (Savvy?)

    — Is it possible to see if C# is best for me? or C++? Thanks.
    Thanks in advance! – JB

  134. JB
    Comment by JB | 2012/01/29 at 13:17:05

    for the sake of short tempered Programmers…
    I will try to simplify my question I asked earlier.. [wow. You guys get serious about all this stuff. ]

    QUESTION: would c# or C++ be better to learn for making games, Windows applications, small and big. Cost accounting programs, Database AeroIndustry programs. statistics, parts, cost, billing, etc.

    I do this stuff with Webscripting now.. PHP, MYSQL, etc., but want to build independent software without internet.

    THANK YOU TO ALL WHO RESPOND>

  135. Comment by locnk | 2012/02/01 at 12:43:53

    In case that the program needs a huge operating memory (3~10GB), what is your suggestion, C++ or C# should be used?
    As far as I understand, C++ is in 32bit whereas C# is with 64bit. Is that right?

  136. JB
    Comment by JB | 2012/02/01 at 12:51:49

    LOCNK: Im no pro, but I believe you have to port C++ over from 32 to 64. there are a few things that will have to be done to make this migration successful.

    -JB

    REFERENCE: http://www.linuxquestions.org/questions/programming-9/32-bit-to-64-bit-migration-for-c-program-613579/

    and also, I believe in the course of a weekend and a few weekdays I have answered my own question i posted last week. Learn BOTH! !!!!!

    I am still open to suggestions.,

    Thanks,

    JB

  137. JB
    Comment by JB | 2012/02/01 at 12:55:00

    But, yes. Originally C++ was created with 32 bit in mind, However not without some predictions that we will one day evolve to higher Bitrates. 64, 128, 256, etc… as the basic premise will be the same many variables will be recreated to accomodate for better systems.

    I know I am not helping, but I am bouncing my thoughts off your questions to absorb /learn , disect, analyze and interpret for the sake of my learning curve. Thanks for raising that question LOCNK!

    ~JB

  138. Comment by Eric | 2012/02/01 at 17:35:58

    C++ is not limited to 32 bits. Some compilers (such as Microsoft Visual Studio) can compile 64-bit binaries with C++ and have been able to do so for years already.

  139. Comment by Alexander Alvonellos | 2012/03/01 at 23:34:39

    If you’re going to talk about parallelism and concurrency, you need to be demonstrating it in Ada. That’s the bottom line. When you get into pthreads and the multithreading models that are so involved in C/C++, you’re also tying yourself to operating system dependence. It’s really easy to get lost in senseless coding. The problem with teaching concurrency in a byte code compiled language like Java or C# is that you get too far away from the OS and off into this magical wonderlands of objects. Ada is a happy medium between the two of them. Ada’s syntax, library, compiler (GNAT), and type checking system is delectable. Try it.

  140. Comment by elmo | 2012/03/09 at 13:38:11

    ….but since everyone and their grandmother seems to use Java or C# these days….

    :sad: it hurts me a lot even grandmothers seems to use these languages still I know nothing about them. :cry: :cry:
    :???: from where should I start?

  141. Comment by RedCopper | 2012/04/01 at 05:27:10

    Lot of arrogance here with the “real programmers use C++” attitude. I’m surprised those who deride C# for having hand-holding training wheels, don’t realize that that’s the whole point of high-level languages: To make things simpler for the programmer. Well I think people who program in C++ are lazy tyros who need a crutch, as real men program with front panel toggle switches. :roll:

    In the real world, the importance of sheer runtime performance (or more accurately, efficiency) isn’t as important as it once was. The computer spends nearly all its cycles waiting for the user or other hardware to do something. If the user does something and it takes C++ 2ms to complete and C# does the task at an agonizingly slow 3ms, is that an acceptable trade-off if you can get the C# app to market significantly faster?

    Of course, there are plenty of cases where ultimate performance matters. There’s apparently lots of programmers, at least posting here, who write full blown commercial games and operating systems. They shouldn’t even touch C#. It’s neither intended, not is it appropriate for those. For most of us, performance needs to be weighed against other factors: Time to develop; time to test and debug; stability; compatibility; maintainability… Then, and only then, does a good programmer decide which language is “best”. But I guess if all you have is a hammer++…

    And I suspect everyone championing creative, more that one way to do it, outside the box power programming have never been tasked with maintaining a b’zillion lines of code written by a creative, more than one way to do it, outside the box power programmer.

  142. Comment by Eric | 2012/04/01 at 06:33:07

    RedCopper: I agree, it doesn’t really make much sense to say something like “Real programmers use C++”, as we should really just use the best tool for the job.

    Over time, I’ve started to feel like these “language 1 vs. language 2″ threads are bait for a flame war more than anything.

  143. Comment by Rhonald Moses | 2012/04/01 at 06:35:34

    To begin with: Congrats! this thread is 6 years old and still active :grin:

    Again, it’s what you want to do comes first and then comes what you want to use to get what you want, then the third, how good are you with what you want to use to get what you want.

    So, even if you want hardware level interaction, but you are good with C# than C++ (let’s agree, most of the guys haven’t used C++ except for colleges), try to figure our what are the libraries that supports the level of programming you want (unsafe namespace with pointers inside for example).

    If you are well versed with C++ (or willing to spend some time to learn it), then I’d suggest you to go for C++.

    Again, it’s what you want, with what you want and how comfortable are you with what you want to use to get what you want.

    :mrgreen:

  144. Comment by Isaac T | 2012/05/06 at 05:27:35

    I am a C# programmer and am currently teaching myself C++. I haven’t read all the comments so forgive me if I retread over something already stated. Your choice of programming languages deal more with what you plan to program, not simple pros and cons. If you want to create high perfomance graphics programs for Windows, I recommend C++, If you are creating non-graphics intensive applications C# is great. Learn Java, HTML, or XAML for web.

    I learned C# in college. I am learning C++ so I can program DirectX-based apllications. The platform for which you want to program is far more important than a few pros and cons.


Trackbacks & Pingbacks »»

  1. Pingback by Jay L. T. Cornwall’s Personal Site | 2007/09/16 at 13:29:16

    [...] to suppress those concerns back then but after stumbling across a post on Michael Suess’s blog comparing features of C++ with C# I’ve had second thoughts. On that impulse I’ve decided to retarget my natural rendering 3D engine [...]

  2. Pingback by C# Resources for C++ Developers | oweynge | 2009/01/12 at 16:35:05

    [...] C++ vs. C# – a checklist from a C++ Programmers point of view by Michael Suess [...]

  3. Pingback by What is the difference between C# and C ? | Web Moments | 2009/11/21 at 18:38:35

    [...] http://www.thinkingparallel.com/2007/03/…|||there are many differences, in fact, too many to list. They really aren No Related Post [...]

Leave a Reply

HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>