C# vs C++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg

    C# vs C++

    Is there a difference of opinion between C# users and C++ users as to whether
    C# is generally a replacement for C++? I asked this in the C++ thread and
    most people people who responded say that C# is not a replacement for C++.

    Do C# promoters have a different view?

    --
    Greg McPherran
    This domain is for sale! Fast and easy shopping. Trusted and secure since 2005.

  • John Timney \( MVP \)

    #2
    Re: C# vs C++

    Its not an replacement but I would say for many projects its certainly an
    alternative to traditional C++, and typically a lot faster to develop with
    in the .NET IDE.

    The resulting exeecutables are not as fast as native C or C++ (if you know
    how to write C/++ of course) but its a very fast language to pick up and run
    with, thus it has many advantages over coding in C++.

    --
    Regards

    John Timney
    ASP.NET MVP
    Microsoft Regional Director

    "Greg" <gm@mcpherran.c om> wrote in message
    news:EC8DD3F1-A705-490D-B04B-2D0CEE2B3987@mi crosoft.com...[color=blue]
    > Is there a difference of opinion between C# users and C++ users as to
    > whether
    > C# is generally a replacement for C++? I asked this in the C++ thread and
    > most people people who responded say that C# is not a replacement for C++.
    >
    > Do C# promoters have a different view?
    >
    > --
    > Greg McPherran
    > www.McPherran.com[/color]


    Comment

    • Greg

      #3
      Re: C# vs C++

      Thank you, yes it seems like C# is a great language to RAD prototype
      something iteratively and then one can always convert it to C++.
      --
      Greg McPherran
      This domain is for sale! Fast and easy shopping. Trusted and secure since 2005.



      "John Timney ( MVP )" wrote:
      [color=blue]
      > Its not an replacement but I would say for many projects its certainly an
      > alternative to traditional C++, and typically a lot faster to develop with
      > in the .NET IDE.
      >
      > The resulting exeecutables are not as fast as native C or C++ (if you know
      > how to write C/++ of course) but its a very fast language to pick up and run
      > with, thus it has many advantages over coding in C++.
      >
      > --
      > Regards
      >
      > John Timney
      > ASP.NET MVP
      > Microsoft Regional Director
      >
      > "Greg" <gm@mcpherran.c om> wrote in message
      > news:EC8DD3F1-A705-490D-B04B-2D0CEE2B3987@mi crosoft.com...[color=green]
      > > Is there a difference of opinion between C# users and C++ users as to
      > > whether
      > > C# is generally a replacement for C++? I asked this in the C++ thread and
      > > most people people who responded say that C# is not a replacement for C++.
      > >
      > > Do C# promoters have a different view?
      > >
      > > --
      > > Greg McPherran
      > > www.McPherran.com[/color]
      >
      >
      >[/color]

      Comment

      • Lloyd Dupont

        #4
        Re: C# vs C++

        > Thank you, yes it seems like C# is a great language to RAD prototype[color=blue]
        > something iteratively and then one can always convert it to C++.[/color]

        If it is to convert to MC++ there is no reason (MC++ use MSIl as much as
        C#).
        If it is to convert to plain old C++, good luck... you should say: "one
        could always spend Aeons convert it to C++"
        [color=blue]
        > --
        > Greg McPherran
        > www.McPherran.com
        >
        >
        > "John Timney ( MVP )" wrote:
        >[color=green]
        >> Its not an replacement but I would say for many projects its certainly an
        >> alternative to traditional C++, and typically a lot faster to develop
        >> with
        >> in the .NET IDE.
        >>
        >> The resulting exeecutables are not as fast as native C or C++ (if you
        >> know
        >> how to write C/++ of course) but its a very fast language to pick up and
        >> run
        >> with, thus it has many advantages over coding in C++.
        >>
        >> --
        >> Regards
        >>
        >> John Timney
        >> ASP.NET MVP
        >> Microsoft Regional Director
        >>
        >> "Greg" <gm@mcpherran.c om> wrote in message
        >> news:EC8DD3F1-A705-490D-B04B-2D0CEE2B3987@mi crosoft.com...[color=darkred]
        >> > Is there a difference of opinion between C# users and C++ users as to
        >> > whether
        >> > C# is generally a replacement for C++? I asked this in the C++ thread
        >> > and
        >> > most people people who responded say that C# is not a replacement for
        >> > C++.
        >> >
        >> > Do C# promoters have a different view?
        >> >
        >> > --
        >> > Greg McPherran
        >> > www.McPherran.com[/color]
        >>
        >>
        >>[/color][/color]


        Comment

        • Mark Rae

          #5
          Re: C# vs C++

          "Greg" <gm@mcpherran.c om> wrote in message
          news:0BDF9E73-B472-4863-A46B-510DC924BE5F@mi crosoft.com...
          [color=blue]
          > and then one can always convert it to C++.[/color]

          Why???


          Comment

          • Jim Holmes

            #6
            Re: C# vs C++

            > Is there a difference of opinion between C# users and C++ users as to[color=blue]
            > whether C# is generally a replacement for C++? I asked this in the C++
            > thread and most people people who responded say that C# is not a
            > replacement for C++.
            >
            > Do C# promoters have a different view?[/color]

            Check out Kate Gregory's blog at http://www.gregcons.com/KateBlog/default.aspx.
            She's a passionate promoter of of C++ and her thoughts are well worth reading.


            Comment

            • Bob Powell [MVP]

              #7
              Re: C# vs C++

              It takes me less than half the time to develop a program in C# than it does
              to develop the equivalent functionality in C++. I still can't write a low
              level driver in C# tough...

              Horses for courses.

              --
              Bob Powell [MVP]
              Visual C#, System.Drawing

              Ramuseco Limited .NET consulting


              Find great Windows Forms articles in Windows Forms Tips and Tricks


              Answer those GDI+ questions with the GDI+ FAQ


              All new articles provide code in C# and VB.NET.
              Subscribe to the RSS feeds provided and never miss a new article.





              "Greg" <gm@mcpherran.c om> wrote in message
              news:EC8DD3F1-A705-490D-B04B-2D0CEE2B3987@mi crosoft.com...[color=blue]
              > Is there a difference of opinion between C# users and C++ users as to
              > whether
              > C# is generally a replacement for C++? I asked this in the C++ thread and
              > most people people who responded say that C# is not a replacement for C++.
              >
              > Do C# promoters have a different view?
              >
              > --
              > Greg McPherran
              > www.McPherran.com[/color]


              Comment

              • Richard Grimes

                #8
                Re: C# vs C++

                John Timney ( MVP ) wrote:[color=blue]
                > The resulting exeecutables are not as fast as native C or C++ (if you
                > know how to write C/++ of course) but its a very fast language to
                > pick up and run with, thus it has many advantages over coding in C++.[/color]

                Done any comparisons? Try it, you might be surprised.

                I did some comparisons and was surprised and showed them to someone on
                the C++ team and he told me that they were just what he expected.

                The problem is that when most people think of .NET they think
                'interpreter', or 'Java', or godforbid, Visual Basic. And so they think
                'bad performance'. They shouldn't.

                I think of the JIT compiler as being the back end of a C++ compiler (it
                was written by people from the C++ team). If you discount the time that
                the JIT compiler takes then for fully trusted code there is no reason
                why it should be significantly slower than code generated by the
                unmanaged C++ compiler. The only possible issue may be garbage
                collection.

                Of course, if you know of other areas of the .NET runtime which are
                significantly slower than the equivalent in Win32 then you should post
                them here so that we all can avoid using them <g>.

                Richard
                --




                Comment

                • Richard Grimes

                  #9
                  Re: C# vs C++

                  Bob Powell [MVP] wrote:[color=blue]
                  > It takes me less than half the time to develop a program in C# than
                  > it does to develop the equivalent functionality in C++. I still can't
                  > write a low level driver in C# though...[/color]

                  You still cannot (should not) in managed C++ either <g>.

                  But I am not sure if the OP is referring to C++ in general, or to
                  managed C++.
                  [color=blue]
                  > Horses for courses.[/color]

                  .... and for glue when they are knackered ;-)

                  Richard
                  --




                  Comment

                  • Marc Noon

                    #10
                    Re: C# vs C++

                    A good litmus test would be to write a prime number generator.

                    Then after 10000 or so just see how long it took in c# and c++.

                    Marc N.
                    --
                    In all the universe, and in all of space, resides a time and a place, when
                    you blink, let it be, in a sequence of events.

                    "Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
                    news:uE6geVl$FH A.360@TK2MSFTNG P09.phx.gbl...[color=blue]
                    > It takes me less than half the time to develop a program in C# than it
                    > does to develop the equivalent functionality in C++. I still can't write a
                    > low level driver in C# tough...
                    >
                    > Horses for courses.
                    >
                    > --
                    > Bob Powell [MVP]
                    > Visual C#, System.Drawing
                    >
                    > Ramuseco Limited .NET consulting
                    > http://www.ramuseco.com
                    >
                    > Find great Windows Forms articles in Windows Forms Tips and Tricks
                    > http://www.bobpowell.net/tipstricks.htm
                    >
                    > Answer those GDI+ questions with the GDI+ FAQ
                    > http://www.bobpowell.net/faqmain.htm
                    >
                    > All new articles provide code in C# and VB.NET.
                    > Subscribe to the RSS feeds provided and never miss a new article.
                    >
                    >
                    >
                    >
                    >
                    > "Greg" <gm@mcpherran.c om> wrote in message
                    > news:EC8DD3F1-A705-490D-B04B-2D0CEE2B3987@mi crosoft.com...[color=green]
                    >> Is there a difference of opinion between C# users and C++ users as to
                    >> whether
                    >> C# is generally a replacement for C++? I asked this in the C++ thread and
                    >> most people people who responded say that C# is not a replacement for
                    >> C++.
                    >>
                    >> Do C# promoters have a different view?
                    >>
                    >> --
                    >> Greg McPherran
                    >> www.McPherran.com[/color]
                    >
                    >[/color]


                    Comment

                    • John Timney \( MVP \)

                      #11
                      Re: C# vs C++

                      I think the average figure I saw being spoken about was to expect up to 20%
                      slower. Not significant, and certainly with the increased productivity
                      something that can be worked on in budget if it was an issue. Personally,
                      I've not done a comparison to the levels you would have done Richard.

                      I know that some of the work I have been invoved in recently using native C
                      would have been unworkable in .NET as performance was the driving factor.
                      For me - as long as complete end to end performance was not the driving
                      factor I would choose c# over c/++ anytime.

                      --
                      Regards

                      John Timney
                      ASP.NET MVP
                      Microsoft Regional Director

                      "Richard Grimes" <richardg@mvps. org> wrote in message
                      news:%230Ix3oo$ FHA.1408@TK2MSF TNGP15.phx.gbl. ..[color=blue]
                      > John Timney ( MVP ) wrote:[color=green]
                      >> The resulting exeecutables are not as fast as native C or C++ (if you
                      >> know how to write C/++ of course) but its a very fast language to
                      >> pick up and run with, thus it has many advantages over coding in C++.[/color]
                      >
                      > Done any comparisons? Try it, you might be surprised.
                      >
                      > I did some comparisons and was surprised and showed them to someone on the
                      > C++ team and he told me that they were just what he expected.
                      >
                      > The problem is that when most people think of .NET they think
                      > 'interpreter', or 'Java', or godforbid, Visual Basic. And so they think
                      > 'bad performance'. They shouldn't.
                      >
                      > I think of the JIT compiler as being the back end of a C++ compiler (it
                      > was written by people from the C++ team). If you discount the time that
                      > the JIT compiler takes then for fully trusted code there is no reason why
                      > it should be significantly slower than code generated by the unmanaged C++
                      > compiler. The only possible issue may be garbage collection.
                      >
                      > Of course, if you know of other areas of the .NET runtime which are
                      > significantly slower than the equivalent in Win32 then you should post
                      > them here so that we all can avoid using them <g>.
                      >
                      > Richard
                      > --
                      > http://www.grimes.demon.co.uk/workshops/fusionWS.htm
                      > http://www.grimes.demon.co.uk/workshops/securityWS.htm
                      >[/color]


                      Comment

                      • Jon Skeet [C# MVP]

                        #12
                        Re: C# vs C++

                        Marc Noon <noonm@bellsout h.net> wrote:[color=blue]
                        > A good litmus test would be to write a prime number generator.
                        >
                        > Then after 10000 or so just see how long it took in c# and c++.[/color]

                        Well, that's a good litmus test if your application is going to be
                        processor intensive in a maths kind of way. I suspect that most
                        applications don't actually have a bottleneck like that. I suspect most
                        applications fall into one or more categories:

                        1) No real bottleneck - performance is perfectly acceptable
                        2) Database bottleneck
                        3) Network bottleneck
                        4) Graphics bottleneck (which may be processor related, but in a more
                        framework dependent way, eg using a framework which doesn't have
                        hardware acceleration)

                        --
                        Jon Skeet - <skeet@pobox.co m>
                        http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
                        If replying to the group, please do not mail me too

                        Comment

                        • Jon Skeet [C# MVP]

                          #13
                          Re: C# vs C++

                          Jon Skeet [C# MVP] <skeet@pobox.co m> wrote:[color=blue]
                          > Well, that's a good litmus test if your application is going to be
                          > processor intensive in a maths kind of way. I suspect that most
                          > applications don't actually have a bottleneck like that. I suspect most
                          > applications fall into one or more categories:
                          >
                          > 1) No real bottleneck - performance is perfectly acceptable
                          > 2) Database bottleneck
                          > 3) Network bottleneck
                          > 4) Graphics bottleneck (which may be processor related, but in a more
                          > framework dependent way, eg using a framework which doesn't have
                          > hardware acceleration)[/color]

                          I missed one I'd thought of before: memory bottlenecks, where you have
                          to control the memory allocation really, really tightly. (Embedded
                          systems etc.)

                          --
                          Jon Skeet - <skeet@pobox.co m>
                          http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
                          If replying to the group, please do not mail me too

                          Comment

                          • Scherbina Vladimir

                            #14
                            Re: C# vs C++

                            "Bob Powell [MVP]" <bob@_spamkille r_bobpowell.net > wrote in message
                            news:uE6geVl$FH A.360@TK2MSFTNG P09.phx.gbl...[color=blue]
                            > It takes me less than half the time to develop a program in C# than it
                            > does to develop the equivalent functionality in C++. I still can't write a
                            > low level driver in C# tough...[/color]

                            Each task has it's instruments. an interesting article about .net
                            applications:


                            --
                            Vladimir


                            Comment

                            • Scherbina Vladimir

                              #15
                              Re: C# vs C++

                              "Greg" <gm@mcpherran.c om> wrote in message
                              news:0BDF9E73-B472-4863-A46B-510DC924BE5F@mi crosoft.com...[color=blue]
                              > Thank you, yes it seems like C# is a great language to RAD prototype
                              > something iteratively and then one can always convert it to C++.[/color]

                              It will take a big amount of time. At least because c# has different syntax,
                              and in c++ you should watch for commiting / releasing of memory, etc.
                              Yes, for a small project it would not be diffcult to convert C# code to C++,
                              but imagine corporate application that has a thousands of lines of code. You
                              will need many men-moon and time.

                              --
                              Vladimir


                              Comment

                              Working...