C# vs. C++

Discussion in 'Microsoft VC .NET' started by cj, Jun 20, 2008.

  1. cj

    cj Guest

    I don't want to start a war but why would I choose one over the other?
    First and foremost I need to keep in mind marketability of the skill and
    the future of the language.

    I'm getting the feeling I'll be moving from VB to one or the other. I
    have some say on which but perhaps not the final decision. I have used
    C and C++ a little bit years ago. I have no experience in C#. I don't
    expect it to be that difficult but I hate remembering the idiosyncrasies
    of too many languages so I'd like to pick one C# or C++ and make the
    right choice.
     
    cj, Jun 20, 2008
    #1
    1. Advertisements

  2. Since you're moving from VB I'd say your best bet is C#. C# is very
    good for handling the forms while giving the feeling of power like C+
    +. Also if you're at a business C++ programmers are getting hard to
    find and thus getting expensive.
     
    cfps.Christian, Jun 20, 2008
    #2
    1. Advertisements

  3. cj

    Alcides Guest

    IMHO if you can choose, then choose C#. Easier to master than C++, and
    hides all the pointer management you have in c++. Unless you have some
    strong requirement for C++, to me it is C#.

    Al.
    http://alsql.blogspot.com.
     
    Alcides, Jun 20, 2008
    #3
  4. cj

    Angus Guest

    There is no correct answer. It depends on what you want to do. If you are
    writing business applications (ie standard data processing) then I imagine
    C# will be easier for you to learn if you are coming from VB. I use C++ and
    can tell you it is a steep learning curve. In my case, however, I am glad I
    put myself through it.

    "cj" <> wrote in message
    news:...
    > I don't want to start a war but why would I choose one over the other?
    > First and foremost I need to keep in mind marketability of the skill and
    > the future of the language.
    >
    > I'm getting the feeling I'll be moving from VB to one or the other. I
    > have some say on which but perhaps not the final decision. I have used
    > C and C++ a little bit years ago. I have no experience in C#. I don't
    > expect it to be that difficult but I hate remembering the idiosyncrasies
    > of too many languages so I'd like to pick one C# or C++ and make the
    > right choice.
     
    Angus, Jun 21, 2008
    #4
  5. Angus wrote:
    > In my case, however, I am glad I
    > put myself through it.
    >


    Amen brother :)
     
    Fernando Gómez, Jun 21, 2008
    #5
  6. cj

    PvdG42 Guest

    "cj" <> wrote in message
    news:...
    > I don't want to start a war but why would I choose one over the other?
    > First and foremost I need to keep in mind marketability of the skill and
    > the future of the language.
    >
    > I'm getting the feeling I'll be moving from VB to one or the other. I
    > have some say on which but perhaps not the final decision. I have used C
    > and C++ a little bit years ago. I have no experience in C#. I don't
    > expect it to be that difficult but I hate remembering the idiosyncrasies
    > of too many languages so I'd like to pick one C# or C++ and make the right
    > choice.


    Either might be an excellent choice, depending on what you want your market
    to be. C# is strictly .NET, while C++ can be used to develop for a multitude
    of environments. OTOH, if you will be developing strictly for .NET, C# would
    be the better choice because it's getting support for all the new .NET
    features.
     
    PvdG42, Jun 21, 2008
    #6
  7. cj

    clintonG Guest

    Microsoft developed C# specifically for the web. VB.NET was developed and
    remains being developed using C#.

    What motivated me to choose C# was the indisputable fact that web
    development is a client-server paradigm and as such separate language skills
    are needed for client-side and server-side development.

    JavaScript is the defacto standard for all client-side web development.
    Since JavaScript was derived from C both JavaScript and C# have exactly the
    same punctuation and nearly the same syntax and grammar making it possible
    to say we can learn two or more languages for the price of one so to speak.

    <%= Clinton Gallagher

    "cj" <> wrote in message
    news:...
    >I don't want to start a war but why would I choose one over the other?
    >First and foremost I need to keep in mind marketability of the skill and
    >the future of the language.
    >
    > I'm getting the feeling I'll be moving from VB to one or the other. I
    > have some say on which but perhaps not the final decision. I have used C
    > and C++ a little bit years ago. I have no experience in C#. I don't
    > expect it to be that difficult but I hate remembering the idiosyncrasies
    > of too many languages so I'd like to pick one C# or C++ and make the right
    > choice.
     
    clintonG, Jun 21, 2008
    #7
  8. cj

    Tamas Demjen Guest

    cj wrote:
    > I don't want to start a war but why would I choose one over the other?


    In my opinion C# can't be completely overlooked. If you take a look at
    craigslist, you'll notice that there are a huge number of C# jobs out
    there. Of course there's still a market for C++ programmers, but that
    tends to be the Linux/server side/embedded segment. But even as a C++
    programmer, chances are that you'll have to work with C# or Java at one
    point in your life.

    It's an order of magnitude more difficult to master C++ than C#. In C#
    it's easier to write perfectly clean code with a lot less experience.
    I've seen programmers who struggle with proper C++ programming practices
    and implementation details, which results in difficult to maintain code.
    However, the very same people do a fantastic job when they get a chance
    to program in C#, and their code quality tends to be much higher.

    Dealing with existing C++ code can be a disaster when you have lots of
    inexperienced programmers on your team. To program well in C++ you have
    to learn disciplined modern C++ practices, such as reference counted
    smart pointers, RAII, exception safety, etc. Picking up a good style is
    impossible when you learn from old C++ books. Companies who hire C++
    programmers tend to have lots of legacy code that I wouldn't consider
    modern or easy to maintain.

    When practices right, I love modern C++ a lot, but even I tend to admit
    that programming in C# or Java is more relaxed.

    The decision is up to you, because there's a market for good C++
    programmers. For example, device drivers or game engines can't be
    written in C# yet. But you have to work a lot harder to achieve success
    in C++ than in C#.

    If your question is related to C++/CLI (programming .NET in C++), then I
    don't recommend it. You should know that Microsoft has poor Windows
    Forms and Web Services development support for C++/CLI. C++/CLI
    currently is a lot lower class citizen language in .NET than C#.

    Tom
     
    Tamas Demjen, Jun 21, 2008
    #8
  9. >such as reference counted smart pointers
    There's no such thing. That's why they are smart, they handle it for you.

    --

    Regards,
    Alvin Bruney [MVP ASP.NET]

    [Shameless Author plug]
    The O.W.C. Black Book, 2nd Edition
    Exclusively on www.lulu.com/owc $19.99
    -------------------------------------------------------


    "Tamas Demjen" <> wrote in message
    news:...
    > cj wrote:
    >> I don't want to start a war but why would I choose one over the other?

    >
    > In my opinion C# can't be completely overlooked. If you take a look at
    > craigslist, you'll notice that there are a huge number of C# jobs out
    > there. Of course there's still a market for C++ programmers, but that
    > tends to be the Linux/server side/embedded segment. But even as a C++
    > programmer, chances are that you'll have to work with C# or Java at one
    > point in your life.
    >
    > It's an order of magnitude more difficult to master C++ than C#. In C#
    > it's easier to write perfectly clean code with a lot less experience. I've
    > seen programmers who struggle with proper C++ programming practices and
    > implementation details, which results in difficult to maintain code.
    > However, the very same people do a fantastic job when they get a chance to
    > program in C#, and their code quality tends to be much higher.
    >
    > Dealing with existing C++ code can be a disaster when you have lots of
    > inexperienced programmers on your team. To program well in C++ you have to
    > learn disciplined modern C++ practices, such as reference counted smart
    > pointers, RAII, exception safety, etc. Picking up a good style is
    > impossible when you learn from old C++ books. Companies who hire C++
    > programmers tend to have lots of legacy code that I wouldn't consider
    > modern or easy to maintain.
    >
    > When practices right, I love modern C++ a lot, but even I tend to admit
    > that programming in C# or Java is more relaxed.
    >
    > The decision is up to you, because there's a market for good C++
    > programmers. For example, device drivers or game engines can't be written
    > in C# yet. But you have to work a lot harder to achieve success in C++
    > than in C#.
    >
    > If your question is related to C++/CLI (programming .NET in C++), then I
    > don't recommend it. You should know that Microsoft has poor Windows Forms
    > and Web Services development support for C++/CLI. C++/CLI currently is a
    > lot lower class citizen language in .NET than C#.
    >
    > Tom
     
    Alvin Bruney [ASP.NET MVP], Jun 21, 2008
    #9
  10. cj

    Arne Vajhøj Guest

    cj wrote:
    > I don't want to start a war but why would I choose one over the other?
    > First and foremost I need to keep in mind marketability of the skill and
    > the future of the language.
    >
    > I'm getting the feeling I'll be moving from VB to one or the other. I
    > have some say on which but perhaps not the final decision. I have used
    > C and C++ a little bit years ago. I have no experience in C#. I don't
    > expect it to be that difficult but I hate remembering the idiosyncrasies
    > of too many languages so I'd like to pick one C# or C++ and make the
    > right choice.


    It depends a bit on the app.

    First note that there are actually 3 choices: C#, C++ for .NET and
    C++ for native.

    But unless the code you want to write is special, then you should
    got for C#. It is simply easier to do than C++.

    That is also reflected in the job market where even though there are
    plenty of C++ jobs, then C# has passed C++ in most markets and
    seems headed to pass C++ in the rest of the markets soon.

    Arne
     
    Arne Vajhøj, Jun 21, 2008
    #10
  11. cj

    Arne Vajhøj Guest

    clintonG wrote:
    > Microsoft developed C# specifically for the web.


    I don't think so. I believe C# was developed to be a general
    language.

    > JavaScript is the defacto standard for all client-side web development.


    For the code part of it at least.

    > Since JavaScript was derived from C both JavaScript and C# have exactly
    > the same punctuation and nearly the same syntax and grammar making it
    > possible to say we can learn two or more languages for the price of one
    > so to speak.


    C# and JavaScript both belongs to the C family of languages. But they
    are somwhat different languages anyway.

    Arne
     
    Arne Vajhøj, Jun 21, 2008
    #11
  12. cj

    RFOG Guest

    En 21/06/2008 06:39:43, MC <>
    escribió:

    >
    > "Peter Duniho" <> wrote in message
    > news:blush:...
    >> On Fri, 20 Jun 2008 20:34:46 -0700, Michael D. Ober
    >> <obermd.@.alum.mit.edu.nospam.> wrote:
    >>
    >>>> C++ is a dying language. [...]
    >>>
    >>> Huh? Our entire telecommunications industry is written in C and C++
    >>> and
    >>> C++ is still the way to go for embedded systems.

    >>
    >> I think he meant that "C++ is a dying language" in the same way that
    >> FORTRAN and COBOL are "dying languages". Of course, those languages
    >> have
    >> been dying for decades and still are in broad use. So C++ could take a
    >> little while to finally kick the bucket too. :)

    >
    > Right. C++ is no longer taught to computer science students, at least
    > not as one of their fundamental skills -- Java dominates academia now,
    > and C# is catching on.
    >
    > And I think you'll find that in embedded systems, what is actually
    > written is closer to C than to C++. C is going to live a long time as a
    > highly portable lower-level language.
    >


    I strongly disagree. Of course C++ is alive into embedded systems, but you
    forget one thing: Java VM is done in C++, and if C++ disappears... Windows
    will disappear because Windows is done in C and most in C++... Linux will
    disappear too.

    And actually it is impssible to buid an OS in Java or in a .NET languge.
    ..NET MicroFramework is the most low level C# and it is a layer over...
    emmmm... rrrrr... ¡C++! Microprocessors that run Java are anecdotic ones,
    and very expensive.

    >> As far as embedded systems go, I think you will find that just as
    >> C++ superceded assembly and hand-written machine code for embedded
    >> systems, so too is C++ likely to be superceded by some other language.
    >> For example, Java is already in widespread use as a platform language
    >> for
    >> mobile phones,


    That is a common error. Java run into mobiles... because Java runtime is
    done in C++ into mobiles. All software into a Phone or a PDA or a Ebook
    reader, or any handheld into market is done in... in... ¡C++! They can run
    Java (and .NET) because they have layers over C++ that allows run those
    frameworks.

    >> and it's not unreasonable to expect that inasmuch as
    >> Windows is the OS for some embedded systems, C# and .NET will wind up
    >> being commonly used in embedded systems as well.

    >


    You have .NET MicroFramework, that is a layer over C++ form tiny 32 bit
    microprocessors.

    Canonical C# and I supponse Java does never can be languages to buil OS
    because none of them can deal directly with hardware and all of them needs
    a layer over hardware to run, to interpret bytecode and to convert that
    bytecode into real machine codes and to convert .NET and Java system calls
    into real system hardware access. How do you install an interruption
    vector in C#? Or how do you configure token 0 to token 3 gate jumps and
    reverse? LDT/GDT access. Convert Base memory address into process
    address...

    C# has pointers, but pointers in C# does not allow to access directly to
    hardware.

    > I agree. Also, Niklaus Wirth (the inventor of Pascal) has floated some
    > interesting ideas for embedded-systems languages recently. They are of
    > course not full industrial-strength tools, but prototypes of interesting
    > ideas.
    >
    > Back to the original poster -- One BIG point is that the transition
    >
    > Visual Basic --> Visual Basic .NET --> C# --> C or C++
    >
    > is a LOT easier to make than if you do the last steps in the reverse
    > order.
    >
    >




    --
    Microsoft Visual C++ MVP
    ========================
    Mi blog sobre programación: http://geeks.ms/blogs/rfog
    Momentos Leves: http://momentosleves.blogspot.com/
    Cosas mías: http://rfog.blogsome.com/
    Libros, ciencia ficción y programación
    ========================================
    Un sistema escolar que no tenga a los padres como cimiento es igual a una
    cubeta con un agujero en el fondo.
    -- Jesse Jackson.
     
    RFOG, Jun 21, 2008
    #12
  13. cj

    Nick Guest

    MC wrote:
    >> Dealing with existing C++ code can be a disaster when you have lots of
    >> inexperienced programmers on your team. To program well in C++ you have
    >> to learn disciplined modern C++ practices, such as reference counted
    >> smart pointers, RAII, exception safety, etc. Picking up a good style is
    >> impossible when you learn from old C++ books. Companies who hire C++
    >> programmers tend to have lots of legacy code that I wouldn't consider
    >> modern or easy to maintain.

    >
    > That is a good point. Object-oriented programming wasn't mature when C++ came into use. There is a lot of bad C++ code in the world, and C++ makes it easy to write bad code and create programs that crash.
    >


    Curious. I wouldn't see C# as fundamentally better for writing
    Object-oriented code. I see the two languages as essentially the same
    but C# has removed the need for explicit memory management and a few
    other house keeping issues (ok I know C# isn't quite as flexible and
    full featured as C++). So C# is a bit like driving an automatic rather
    than as stick shift. The really complicated thing is the driving not the
    mundane task of changing gear.

    I would chose C# as it is easier than C++ but more importantly you are
    more likely to be given new code to write in C# rather than decipher
    some arcane legacy system in C++.


    > I think C will outlive C++. C is going to continue to be a good language for small routines where performance is paramount. For such things, I find myself writing "C-barely-plus-plus," which is C with slight use of the C++ extensions. But when I want real object-oriented programming, I use C#.


    I can't see why anyone would want to use C rather than C++?
     
    Nick, Jun 21, 2008
    #13
  14. cj

    RFOG Guest

    En 21/06/2008 12:37:21, Nick <> escribió:


    >> I think C will outlive C++. C is going to continue to be a good
    >> language for small routines where performance is paramount. For such
    >> things, I find myself writing "C-barely-plus-plus," which is C with
    >> slight use of the C++ extensions. But when I want real object-oriented
    >> programming, I use C#.

    >
    > I can't see why anyone would want to use C rather than C++?


    The today only reason for that is the system will not have a C++ compiler.

    --
    Microsoft Visual C++ MVP
    ========================
    Mi blog sobre programación: http://geeks.ms/blogs/rfog
    Momentos Leves: http://momentosleves.blogspot.com/
    Cosas mías: http://rfog.blogsome.com/
    Libros, ciencia ficción y programación
    ========================================
    Un sistema escolar que no tenga a los padres como cimiento es igual a una
    cubeta con un agujero en el fondo.
    -- Jesse Jackson.
     
    RFOG, Jun 21, 2008
    #14
  15. "RFOG" <> ha scritto nel messaggio
    news:blush:p.uc3f9esf2upo6d@red-mars-server...

    > I strongly disagree. Of course C++ is alive into embedded systems, but you
    > forget one thing: Java VM is done in C++, and if C++ disappears... Windows
    > will disappear because Windows is done in C and most in C++... Linux will
    > disappear too.


    I agree with you, RFOG.

    Only one point: Linux (the kernel) is built in pure C (not C++).


    > And actually it is impssible to buid an OS in Java or in a .NET languge.
    > .NET MicroFramework is the most low level C# and it is a layer over...
    > emmmm... rrrrr... ¡C++!


    You're right.

    Moreover, I doubt that very big and successfull apps (like Microsoft Office,
    or Visual Studio, or even non-Microsoft apps like Photoshop) could be built
    using C# (or Java...). Or, if they would be built with C# or some other
    "managed" language, what would be the memory occupation and would they be as
    snappy as the C++ versions?

    Instead, for Internet stuff like ASP.NET, I think that C# (or VB.NET as
    well) is a clear winner over C++.

    Just use the right tool for the right job.

    Giovanni
     
    Giovanni Dicanio, Jun 21, 2008
    #15
  16. cj

    RFOG Guest

    En 21/06/2008 15:14:05, Giovanni Dicanio <>
    escribió:

    > "RFOG" <> ha scritto nel messaggio
    > news:blush:p.uc3f9esf2upo6d@red-mars-server...
    >
    >> I strongly disagree. Of course C++ is alive into embedded systems, but
    >> you
    >> forget one thing: Java VM is done in C++, and if C++ disappears...
    >> Windows
    >> will disappear because Windows is done in C and most in C++... Linux
    >> will
    >> disappear too.

    >
    > I agree with you, RFOG.
    >
    > Only one point: Linux (the kernel) is built in pure C (not C++).
    >


    Yes, my error. :) Linus Tolvards doesn't like C++. But KDE, for example,
    is C++ plus meta-C++.

    >
    >> And actually it is impssible to buid an OS in Java or in a .NET languge.
    >> .NET MicroFramework is the most low level C# and it is a layer over...
    >> emmmm... rrrrr... ¡C++!

    >
    > You're right.
    >
    > Moreover, I doubt that very big and successfull apps (like Microsoft
    > Office,
    > or Visual Studio, or even non-Microsoft apps like Photoshop) could be
    > built
    > using C# (or Java...). Or, if they would be built with C# or some other
    > "managed" language, what would be the memory occupation and would they
    > be as
    > snappy as the C++ versions?
    >
    > Instead, for Internet stuff like ASP.NET, I think that C# (or VB.NET as
    > well) is a clear winner over C++.
    >
    > Just use the right tool for the right job.
    >
    > Giovanni
    >
    >




    --
    Microsoft Visual C++ MVP
    ========================
    Mi blog sobre programación: http://geeks.ms/blogs/rfog
    Momentos Leves: http://momentosleves.blogspot.com/
    Cosas mías: http://rfog.blogsome.com/
    Libros, ciencia ficción y programación
    ========================================
    Un sistema escolar que no tenga a los padres como cimiento es igual a una
    cubeta con un agujero en el fondo.
    -- Jesse Jackson.
     
    RFOG, Jun 21, 2008
    #16
  17. CJ,

    I guess you were surprised of how many replies you got so far!!

    Anyway, if you want to move to C# or C++, know this:

    a.. C# is a virtual machine - a little like java and VB already - at run-time your program is interpreted by another program called the CLR. It shields you from a lot of computer internals, but unlike VB, does a good job of offering you a nice object-oriented API. C# is just so cool for developers! The price to pay for this niceness is that programs are not as low-level as in C++, and thus will run a little slower.

    b.. C++ on the contrary in just above C and assembler in terms of level. C++ will provide you with a rather direct access to the machine, a lot of efficiency, a lot of freedom. However, using that freedom and this more direct access to the OS, you will most probably hang yourself with the rope one day. It is much, much harder to harness all the power of C++, COM, Win32, etc., than it is to learn C# (as mentioned in another post). You can do programs that run faster, but you have less of a safety net when you decide to explore the untamed wilderness.

    Wrapping up the above, C# is perfect for business applications that require more safety and faster development speed. I would say, in general, there way much more market for C#.

    C++ is ideal if you want to do device drivers, develop system components, etc.

    When it come to marketability, you have to assess your geographic situation. If you live in Silicon Valley, you probably need to develop in low-level and learn C++, or even master assembler. If you live in Montreal, the market is much higher level; C# is clearly adviseable. If you're unsure, refer to your local job web-site. Look up for what programer jobs are offered in your vicinity, and what they ask for in terms of knowledge and experience.

    In any event, knowing how to manage a database is always - everywhere in the world - a wonderful though less glamourous asset.

    Be good!


    "cj" <> wrote in message news:...
    >I don't want to start a war but why would I choose one over the other?
    > First and foremost I need to keep in mind marketability of the skill and
    > the future of the language.
    >
    > I'm getting the feeling I'll be moving from VB to one or the other. I
    > have some say on which but perhaps not the final decision. I have used
    > C and C++ a little bit years ago. I have no experience in C#. I don't
    > expect it to be that difficult but I hate remembering the idiosyncrasies
    > of too many languages so I'd like to pick one C# or C++ and make the
    > right choice.
     
    Daniel Boulerice, Jun 21, 2008
    #17
  18. Daniel Boulerice wrote:

    >
    > CJ,
    >
    > I guess you were surprised of how many replies you got so far!!
    >
    > Anyway, if you want to move to C# or C++, know this:
    >
    > a.. C# is a virtual machine - a little like java and VB already -
    > at run-time your program is interpreted by another program called the
    > CLR.


    No, it isn't. At runtime, it is compiled just-in-time and it runs
    natively, it is not interpreted. The CLR is not another program either,
    it is the main runtime library that comes with .NET, and also runs
    natively. AFAIK, most C++ products also have a runtime library. .NET's
    CLR is just more extensive.
    --
    Rudy Velthuis http://rvelthuis.de

    "This book fills a much-needed gap."
    -- Moses Hadas (1900-1966) in a review
     
    Rudy Velthuis, Jun 21, 2008
    #18
  19. cj

    Ian Semmel Guest

    "cj" <> wrote in message
    news::

    > I don't want to start a war but why would I choose one over the other?
    > First and foremost I need to keep in mind marketability of the skill and
    > the future of the language.
    >
    > I'm getting the feeling I'll be moving from VB to one or the other. I
    > have some say on which but perhaps not the final decision. I have used
    > C and C++ a little bit years ago. I have no experience in C#. I don't
    > expect it to be that difficult but I hate remembering the idiosyncrasies
    > of too many languages so I'd like to pick one C# or C++ and make the
    > right choice.


    Over 80% of the world's financial transactions are still executed COBOL
    code. Not bad for a language over 40 years old.

    The point is, that companies do not rewrite their systems just because a
    new technology or language comes about. Their investment is probably
    many millions of dollars in software development. And if it aint broke,
    don't fix it.

    Although it isn't 'cool' to learn C/C++ nowadays, it will put you in
    good stead in the employment market if you know them. In my opinion, it
    would be easier to learn C/C++ (native) first and then go on to C#, as
    you are really learning what goes on under the C# hood.

    C# is a great programming language and has removed many of the sloppy
    methods prevalent in C. C++ could have been a lot better than it is, but
    unfortunately it was decided to make it compatible with C. With these
    languages, you need self-imposed discipline to write them successfully
    (although it is possible to write garbage programs in C#).
     
    Ian Semmel, Jun 21, 2008
    #19
  20. cj

    Arne Vajhøj Guest

    RFOG wrote:
    > En 21/06/2008 12:37:21, Nick <> escribió:
    >>> I think C will outlive C++. C is going to continue to be a good
    >>> language for small routines where performance is paramount. For such
    >>> things, I find myself writing "C-barely-plus-plus," which is C with
    >>> slight use of the C++ extensions. But when I want real
    >>> object-oriented programming, I use C#.

    >>
    >> I can't see why anyone would want to use C rather than C++?

    >
    > The today only reason for that is the system will not have a C++ compiler.


    There are cases (embedded or kernel) where you want very tight control
    over the generated code. In which case you will either pick C or
    pick C++ and only use a subset of C++ (that likely will look
    relative similar to C).

    Arne
     
    Arne Vajhøj, Jun 21, 2008
    #20
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page