C# vs. C++

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

    #16
    Re: C# vs. C++

    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

    Comment

    • Ian Semmel

      #17
      Re: C# vs. C++



      "cj" <cj@nospam.nosp amwrote in message
      news:uKLx1Px0IH A.6096@TK2MSFTN GP06.phx.gbl:
      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#).


      Comment

      • MC

        #18
        Re: C# vs. C++

        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.

        Intermediate code is not interpreted, it is JIT-compiled. It can also be precompiled if you wish.

        There is a reason we want to be shielded from machine internals just a bit -- Not all of the computers of the future are going to be 32-bit Pentiums! That is the rationale for using intermediate code and JIT compilation.


        Comment

        • =?ISO-8859-15?Q?Arne_Vajh=F8j?=

          #19
          Re: C# vs. C++

          RFOG wrote:
          En 21/06/2008 12:37:21, Nick <Nick.Spam@yaho o.co.ukescribió :
          >>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

          Comment

          • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

            #20
            Re: C# vs. C++

            Daniel Boulerice wrote:
            * 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.
            Try google "JIT compiler".

            Arne

            Comment

            • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

              #21
              Re: C# vs. C++

              Nick wrote:
              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
              More access levels, interfaces and delegates seems
              to me to be features that makes good OOP easier.

              Arne

              Comment

              • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

                #22
                Re: C# vs. C++

                Michael D. Ober wrote:
                "MC" <for.address.lo ok@www.ai.uga.e du.slash.mcwrot e in message
                news:%2356u1pz0 IHA.1772@TK2MSF TNGP03.phx.gbl. ..
                >"cj" <cj@nospam.nosp amwrote in message
                >news:uKLx1Px0I HA.6096@TK2MSFT NGP06.phx.gbl.. .
                >>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.
                >>
                >C++ is a dying language. It was an experimental object-oriented
                >C-based language and has been superseded by Java and C#, which are the
                >real thing. Even the inventor of C++ did not intend it to last very
                >long, despite the great popularity that it achieved in the late 1990s.
                >
                Huh? Our entire telecommunicati ons industry is written in C and C++ and
                C++ is still the way to go for embedded systems.
                And a lot of other stuff.

                Most of the OLE/COM stuff in Windows and Office is C++.

                Lots of Windows apps out there are also build using MFC.

                And I would not call C++ experimental. It is used in a lot
                of production code.

                Of course things has progressed since the mid 1980's. Java
                learned from and improved from C++. And C# learned from and
                improved from Java.

                For a typical business application I will absolutely
                recommend Java or C# over C++.

                But C++ will live on for many years. Because of the bazillions
                of lines of code that exist. And because of special requirements
                for hardware access or real time characteristics that Java and C#
                can not meet.

                Arne

                Comment

                • Cholo Lennon

                  #23
                  Re: C# vs. C++


                  "Arne Vajhøj" <arne@vajhoej.d kescribió en el mensaje
                  news:485d64a7$0 $90268$14726298 @news.sunsite.d k...
                  Nick wrote:
                  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
                  >
                  More access levels, interfaces and delegates seems
                  to me to be features that makes good OOP easier.
                  >
                  Just some clarification: In C++ you have interfaces (abstract classes) and
                  delegates (std::tr1::func tion or boost::function )

                  Regards

                  --
                  Cholo Lennon
                  Bs.As.
                  ARG


                  Comment

                  • =?ISO-8859-1?Q?Fernando_G=F3mez?=

                    #24
                    Re: C# vs. C++

                    Giovanni Dicanio wrote:
                    "RFOG" <no@mail.comh a scritto nel messaggio
                    news:op.uc3f9es f2upo6d@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?
                    >
                    He. Try SQL Server 2005 Management Studio. It really sucks.
                    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
                    >
                    >

                    Comment

                    • RFOG

                      #25
                      Re: C# vs. C++

                      En 21/06/2008 22:24:33, Arne Vajhøj <arne@vajhoej.d kescribió:
                      RFOG wrote:
                      >En 21/06/2008 12:37:21, Nick <Nick.Spam@yaho o.co.ukescribió :
                      >>>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
                      Yes, I agree with that. But you suppose a world centered in x86 arch...
                      For one PC there are a zillion of other devices that run other
                      microprocessors and some C++ compilers (CodeWarrior for ColdFire, one that
                      I know, for example) are very very agressive optimizing and restructures
                      code avoiding in most cases vtables and so, making more compact code than
                      a person can do.

                      But, of course, in most cases in embedded scenarios developers only uses
                      C++ as a "better C". It is, for example, very absurd to instantiate a
                      polimorphic class with ten levels of abstraction into a high precision
                      timer interrupt and deallocate in each interrupt finishing.

                      --
                      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
                      =============== =============== ==========
                      Debemos vivir y trabajar, en cada momento, como si tuviésemos la eternidad
                      ante nosotros.
                      -- Gabriel Marcel.

                      Comment

                      • Rudy Velthuis

                        #26
                        Re: C# vs. C++

                        Alvin Bruney [ASP.NET MVP] wrote:
                        such as reference counted smart pointers
                        There's no such thing. That's why they are smart, they handle it for
                        you.
                        That doesn't mean they can't use reference counting as a mechanism, and
                        if they do, they are reference counted.

                        --
                        Rudy Velthuis http://rvelthuis.de

                        "Once you've written TBicycle, you never forget how."
                        -- Oliver Townshend in b.p.d.n-t.

                        Comment

                        • Hendrik Schober

                          #27
                          Re: C# vs. C++

                          MC <for.address.lo ok@www.ai.uga.e du.slash.mcwrot e:
                          [...]
                          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.
                          >
                          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. [...]

                          IMO these to paragraphs contradict each other. C makes it a lot
                          easier to write bad, crashing code, than C++ does.

                          Schobi

                          --
                          SpamTrap@gmx.de is never read
                          I'm HSchober at gmx dot de
                          "I guess at some point idealism meets human nature and
                          explodes." Daniel Orner


                          Comment

                          • Daniel James

                            #28
                            Re: C# vs. C++

                            In article news:<#UIXFLA1I HA.1772@TK2MSFT NGP03.phx.gbl>, Hendrik
                            Schober wrote:
                            IMO these to paragraphs contradict each other. C makes it a lot
                            easier to write bad, crashing code, than C++ does.
                            No, if you really /want/ bad, crashing, code you can write it just as
                            easily in C++ as in C (it might be a bit harder in C#, but you can
                            still do it).

                            OTOH if you want fast, compact, readable code that your programmers can
                            easily understand and maintain (even if they're not the same
                            programmers that wrote it) then it is much easier to do that well in
                            C++ than in C. C# can also give you some of that, but C++ is more
                            flexible and powerful, has more 3rd-party library support, and runs on
                            more platforms.

                            Cheers,
                            Daniel.



                            Comment

                            • Alvin Bruney [ASP.NET MVP]

                              #29
                              Re: C# vs. C++

                              C# can also give you some of that, but C++ is more
                              flexible and powerful,
                              Why is it more powerful and more flexible? I thought you could write
                              'unsafe' code in C#. Doesn't that make it as powerful and as flexible. Or
                              perhaps unsafe code was removed from C#, if so then I stand corrected.

                              --

                              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
                              -------------------------------------------------------


                              "Daniel James" <wastebasket@no spam.aaisp.orgw rote in message
                              news:VA.0000143 c.42ba6439@nosp am.aaisp.org...
                              In article news:<#UIXFLA1I HA.1772@TK2MSFT NGP03.phx.gbl>, Hendrik
                              Schober wrote:
                              >IMO these to paragraphs contradict each other. C makes it a lot
                              >easier to write bad, crashing code, than C++ does.
                              >
                              No, if you really /want/ bad, crashing, code you can write it just as
                              easily in C++ as in C (it might be a bit harder in C#, but you can
                              still do it).
                              >
                              OTOH if you want fast, compact, readable code that your programmers can
                              easily understand and maintain (even if they're not the same
                              programmers that wrote it) then it is much easier to do that well in
                              C++ than in C. C# can also give you some of that, but C++ is more
                              flexible and powerful, has more 3rd-party library support, and runs on
                              more platforms.
                              >
                              Cheers,
                              Daniel.
                              >
                              >
                              >

                              Comment

                              • Alvin Bruney [ASP.NET MVP]

                                #30
                                Re: C# vs. C++

                                Huh? Our entire telecommunicati ons industry is written in C and C++

                                Sleight of hand. I worked for a few years in the telecommunicati ons
                                industry. C and C++ happen to be entrenched there because at the time that
                                was the dominant languages. As these pieces get re-written, rest-assured
                                they won't be re-written in these languages because there's nothing to gain
                                using these technologies in telecommunicati ons. I know, I've been there.

                                --

                                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
                                -------------------------------------------------------


                                "Peter Duniho" <NpOeStPeAdM@nn owslpianmk.comw rote in message
                                news:op.uc2zr5r 48jd0ej@petes-computer.local. ..
                                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 telecommunicati ons 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. :)
                                >
                                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, 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.
                                >
                                Pete

                                Comment

                                Working...