C# versus C++

In my previous post I’ve tried to explain why I think there are too many programming languages, and stated that it would be better that only 2-3 would survive.

I chosen:

  • Haskell for being ultimately functional (it is very good for certain reasons),
  • Python for being ultimately easy to read and write, and
  • C++ (C++0x) for  no-compromise in it’s performance-orientation (“zero-overhead principle”) and being extremely flexible.

Of course, the choice is  quite accident (i.e. Python could be replaced with javascript, Haskell with some Lisp dialect etc.)

All I wanted to say is that there is no need for more than one language per niche, and there is no so much niches.

For general-purpose applications were speed is critical I’ve chosen C++. Why not C#? Well…

  • C++ is more general-purpose
  • It has better performance (at least for now)

Every point where C# is better that C++,  C++ can either (most cases) implement it as a library,  or add a missing feature in future version. Obviously, vice-versa is almost as true as this is. But if those both language will develop in same direction to a common denominator (C# with option to disable garbage-collection etc. or C++ with features from C#), it not really important how you’ll name it (let’s call it ManagedC+# or whatever…)

For now, if you think you need C#, think again:

  • maybe you need  Python with C++ (try SWIG and Boost.Bind)
  • if performance is less important – just Python
  • if you code for funHaskell is ideal
  • may be you don’t need to write it at all, maybe somebody already wrote it – check in on sourceforge.

Tags: ,

3 Responses to “C# versus C++”

  1. spinoza1111 Says:

    As I’ve pointed out in my book, “Build Your Own .Net Language and Compiler”, and with all due respect, it’s not grammatical nor meaningful except as a crude generalization, to say that P has more performance where P is a programming language.

    I realize that it means that “most or many programmers will produce more code that runs more or less faster or with less of a memory footpriint with my favorite language”.

    But this is so ceteris paribus, so in need of a qualification, and the competence of actual programmers varies so widely, as to be an assertion not worth making.

    Whereas software reliability against bad code is something one can take to the bank, or today put in your mattress given the condition of banks.

    • komap Says:

      When you say that there is no performance difference between languages, you probably mean that the performance of a languages is similar under a platform such as .net or Java.

      But if we are talking about e.g. real-time embedded system, then there certainly is a difference in performance between languages; compare, say, assembler with a language with dynamically-typing or garbage-collection, or interpreted, or an OO language where all methods are virtual.

  2. silkenpy Says:

    If you need to use swig for wrapping C++ check my blog.
    http://silkenpy.wordpress.com/

    Cheers

Leave a reply to spinoza1111 Cancel reply