Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. The Lounge
  3. Why do some people prefer C over C++?

Why do some people prefer C over C++?

Scheduled Pinned Locked Moved The Lounge
c++hardwarequestion
61 Posts 20 Posters 4 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Code2326

    I was told C could do more than C++ even though C++ is the "evolution" of C. In the sense that I'm programming with robots such as those in FIRST, I was also told that C is "closer" to the hardware. Are all of those true? Mind if someone tell me why he/she prefer C over C++? I'm so confused and lost. :confused:

    G Offline
    G Offline
    Gary R Wheeler
    wrote on last edited by
    #19

    C is much simpler to learn. No object-oriented stuff, operator overloading, exceptions, etc. C++ offers vastly better facilities for software engineering a project. Namespaces, classes, etc. If you've ever maintained a 250,000 line code base in C (which I have), you'll understand. C and C++ are equally 'close' to the hardware. There are certain programming idioms that are more succinctly expressed in C++ than in C. There is no inherent performance disadvantage to C++ for many applications. Most things cited for this bit of FUD (exception handling, for example) are controllable with compiler options. If you don't use that feature, turn it off and its effect on performance is eliminated. Truth be told, I would not be surprised to find some C++ programs that are significantly faster than the corresponding C code, simply due to the fact that the compiler implements certain programming techniques in machine code in C++ that you would have to construct 'by hand' in C. I spent six years doing pure C development. I've spent the last ten years doing C++ work. Given a choice, I will always choose C++ over C.


    Software Zen: delete this;

    Fold With Us![^]

    1 Reply Last reply
    0
    • C Code2326

      I was told C could do more than C++ even though C++ is the "evolution" of C. In the sense that I'm programming with robots such as those in FIRST, I was also told that C is "closer" to the hardware. Are all of those true? Mind if someone tell me why he/she prefer C over C++? I'm so confused and lost. :confused:

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #20

      Because they're stupid. Marc

      Thyme In The Country
      Interacx
      My Blog

      J G M 3 Replies Last reply
      0
      • M Marc Clifton

        Because they're stupid. Marc

        Thyme In The Country
        Interacx
        My Blog

        J Offline
        J Offline
        Josh Smith
        wrote on last edited by
        #21

        Marc Clifton wrote:

        Because they're stupid.

        :laugh: Wow, I didn't see that one coming!

        :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

        1 Reply Last reply
        0
        • C Chris Austin

          Christian Graus wrote:

          Only if C++ is taught *wrong* is it easier to learn C.

          I would agree with you here. I think a lot of people approach C++ as being "just" C with OOP starting out.

          My Blog A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects. - -Lazarus Long

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #22

          Chris Austin wrote:

          I think a lot of people approach C++ as being "just" C with OOP starting out.

          Yeah, a lot of professors are old C programmers, who teach C with classes. That just makes it hard.

          Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

          1 Reply Last reply
          0
          • J James Brown

            not true, C will always be easier to learn because it is such a simple language. C++ is a huge language, far more powerful and expressive than C and subsequently takes alot more time to learn the nuances of the language. OO vs non-OO and the different approaches required for each never formed a part in my argument.


            http://www.catch22.net

            C Offline
            C Offline
            Christian Graus
            wrote on last edited by
            #23

            But, you can teach C++ by starting with the part that is C. That's totally the wrong way to teach it, and teaching it right makes C++ easier than C, IMO. Teaching C++ doesn't have to mean teaching the whole language, just enough to get people started. Then they can move on to templates, STL containers, iostreams, etc, once they have a firm grounding. C is easier because it's simpler, only if you assume that 'learn' means 'know every facet of the language'. As your comment above shows, many people use C++ and never learn how templates work, for example.

            Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

            E J 2 Replies Last reply
            0
            • C Code2326

              I was told C could do more than C++ even though C++ is the "evolution" of C. In the sense that I'm programming with robots such as those in FIRST, I was also told that C is "closer" to the hardware. Are all of those true? Mind if someone tell me why he/she prefer C over C++? I'm so confused and lost. :confused:

              M Offline
              M Offline
              martin_hughes
              wrote on last edited by
              #24

              I really hate arguments about languages - it's all so thoroughly pointless as no one ever wins, and the arguments go on. And on. And on. If any of it really mattered, we'd all still be writing in machine code, or better yet we'd still be calculating stuff on an abacus. C or C++? Who cares? Use whatever you want to use (even VB6 if the feel takes you!), invent your own language if you like - just remember: your end user won't care one jot what language your programs are written in, all they want to know is a)does it do what they want, and b)how long it took you to deliver them.

              "It was the day before today.... I remember it like it was yesterday." -Moleman

              1 Reply Last reply
              0
              • J James Brown

                not true, C will always be easier to learn because it is such a simple language. C++ is a huge language, far more powerful and expressive than C and subsequently takes alot more time to learn the nuances of the language. OO vs non-OO and the different approaches required for each never formed a part in my argument.


                http://www.catch22.net

                E Offline
                E Offline
                El Corazon
                wrote on last edited by
                #25

                James Brown wrote:

                not true, C will always be easier to learn because it is such a simple language

                not true, because eventually you must follow on with storage mechanisms, pointers, pointers to functions, lists, trees, etc. Now you have added more complexity to C to keep up with the capability of C++, and have done it in inconsistant methodologies such that one C programmer has difficult understanding what another did -- and no consistency of performance, one list implimentation is not the same as another. Of course you could say, as long as no one writes anything complex, C is always the winner. Well :doh: I can write a hello world program in ASM more compact too, that doesn't mean it is the right tool for all jobs.

                _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                J 1 Reply Last reply
                0
                • M Marc Clifton

                  Because they're stupid. Marc

                  Thyme In The Country
                  Interacx
                  My Blog

                  G Offline
                  G Offline
                  Gary R Wheeler
                  wrote on last edited by
                  #26

                  Go right ahead, make me feel like a pompous wind-bag :laugh:. Your answer is far more to the point.


                  Software Zen: delete this;

                  Fold With Us![^]

                  E 1 Reply Last reply
                  0
                  • G Gary R Wheeler

                    Go right ahead, make me feel like a pompous wind-bag :laugh:. Your answer is far more to the point.


                    Software Zen: delete this;

                    Fold With Us![^]

                    E Offline
                    E Offline
                    El Corazon
                    wrote on last edited by
                    #27

                    Gary R. Wheeler wrote:

                    Go right ahead, make me feel like a pompous wind-bag

                    my posts were twice the size of yours... if he makes you a pompous wind-bag, what extreme does that make me????

                    _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                    E 1 Reply Last reply
                    0
                    • C Code2326

                      I was told C could do more than C++ even though C++ is the "evolution" of C. In the sense that I'm programming with robots such as those in FIRST, I was also told that C is "closer" to the hardware. Are all of those true? Mind if someone tell me why he/she prefer C over C++? I'm so confused and lost. :confused:

                      C Offline
                      C Offline
                      cp9876
                      wrote on last edited by
                      #28

                      Because they don't want to use object oriented design. My experience in complex projects is that C++ used well results in great code, as fast as C, developed in less time and is far easier to maintain. C++ is also much more fun than C - even when producing great code. Having to develop everything in C is a nightmare scenario! However, developing the skills to use C++ well takes much longer than learning to use C, and I have seen some people who I believe will never make good OO designers. I have seen people with poor C++ skills produce code that is much more obscure than C, is much slower and almost impossible to maintain. It would have been almost impossible to write programs that badly in C, simply because C++ gave them more features to misuse. C++ is a fantastic tool in the hands of a skilled craftsman.


                      Peter "Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

                      1 Reply Last reply
                      0
                      • J Josh Smith

                        Because they have never tried C#. ;P :josh puts on fireproof body suit:

                        :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

                        E Offline
                        E Offline
                        El Corazon
                        wrote on last edited by
                        #29

                        Josh Smith wrote:

                        Because they have never tried C#. :josh puts on fireproof body suit:

                        you should have reversed the order there.... ;P If someone had been faster, they could have got you good.... ;P

                        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                        J 1 Reply Last reply
                        0
                        • E El Corazon

                          James Brown wrote:

                          not true, C will always be easier to learn because it is such a simple language

                          not true, because eventually you must follow on with storage mechanisms, pointers, pointers to functions, lists, trees, etc. Now you have added more complexity to C to keep up with the capability of C++, and have done it in inconsistant methodologies such that one C programmer has difficult understanding what another did -- and no consistency of performance, one list implimentation is not the same as another. Of course you could say, as long as no one writes anything complex, C is always the winner. Well :doh: I can write a hello world program in ASM more compact too, that doesn't mean it is the right tool for all jobs.

                          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                          J Offline
                          J Offline
                          James Brown
                          wrote on last edited by
                          #30

                          sorry sunshine, but no matter what way you look at things, C is a simpler language and is therefore easier to learn. libraries/data structures are irrelevant and never formed a part of my argument.


                          http://www.catch22.net

                          E 1 Reply Last reply
                          0
                          • C Christian Graus

                            But, you can teach C++ by starting with the part that is C. That's totally the wrong way to teach it, and teaching it right makes C++ easier than C, IMO. Teaching C++ doesn't have to mean teaching the whole language, just enough to get people started. Then they can move on to templates, STL containers, iostreams, etc, once they have a firm grounding. C is easier because it's simpler, only if you assume that 'learn' means 'know every facet of the language'. As your comment above shows, many people use C++ and never learn how templates work, for example.

                            Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                            E Offline
                            E Offline
                            El Corazon
                            wrote on last edited by
                            #31

                            Christian Graus wrote:

                            "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax"

                            I just read this.... :doh::doh::omg: That's like seeing... "I am starting a project in 3D graphics for a game... what is 3D graphics?" :doh:

                            _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                            1 Reply Last reply
                            0
                            • E El Corazon

                              Josh Smith wrote:

                              Because they have never tried C#. :josh puts on fireproof body suit:

                              you should have reversed the order there.... ;P If someone had been faster, they could have got you good.... ;P

                              _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                              J Offline
                              J Offline
                              Josh Smith
                              wrote on last edited by
                              #32

                              El Corazon wrote:

                              If someone had been faster, they could have got you good....

                              Lucky me!! :laugh:

                              :josh: My WPF Blog[^] The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it. - Michelangelo (1475-1564)

                              1 Reply Last reply
                              0
                              • J James Brown

                                sorry sunshine, but no matter what way you look at things, C is a simpler language and is therefore easier to learn. libraries/data structures are irrelevant and never formed a part of my argument.


                                http://www.catch22.net

                                E Offline
                                E Offline
                                El Corazon
                                wrote on last edited by
                                #33

                                James Brown wrote:

                                libraries/data structures are irrelevant and never formed a part of my argument

                                But they are an integral part of WRITING code. Learning the language is only the first step. You are implying that as long as no one ever writes in C, C is always easier to learn. Well... true, but irrelevant, since eventually someone MUST write in it.

                                _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                J 1 Reply Last reply
                                0
                                • M Marc Clifton

                                  Because they're stupid. Marc

                                  Thyme In The Country
                                  Interacx
                                  My Blog

                                  M Offline
                                  M Offline
                                  Mark Salsbery
                                  wrote on last edited by
                                  #34

                                  :laugh::laugh::laugh: After so many pompous, wind-bag, 5-worthy posts, that I couldn't decide which to give 5s to you hit it right on the nose! LMAO! El and Gary - Just kidding ;P Mark

                                  Mark Salsbery Microsoft MVP - Visual C++ :java:

                                  1 Reply Last reply
                                  0
                                  • J James Brown

                                    I actually like C++ quite a lot, sometimes very nice code can be written in it and it lends itself very well to many types of program. It is just the 'gotcha's that put me off, and some of the language features that can make code utterly unreadable, templates being the main offender. Also the many implicit behaviours and side-effects that can be introduced by the most innocent of statement.


                                    http://www.catch22.net

                                    E Offline
                                    E Offline
                                    El Corazon
                                    wrote on last edited by
                                    #35

                                    James Brown wrote:

                                    Also the many implicit behaviours and side-effects that can be introduced by the most innocent of statement.

                                    the same can be said of pointers and defines, etc, which are a part of C. In fact templates suffer the same issues of writing with defines, only offer some design refinements. Classes are a pointer table of methods which can be written in C, but with greater risk. You can make C completely unreadable too, but it doesn't prove C is evil, it only tells about the programmer. Not knowing C++, of course it would make it unreadable, but knowing C++ well makes it very readable and much more stable.

                                    _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                    J 1 Reply Last reply
                                    0
                                    • C Christian Graus

                                      But, you can teach C++ by starting with the part that is C. That's totally the wrong way to teach it, and teaching it right makes C++ easier than C, IMO. Teaching C++ doesn't have to mean teaching the whole language, just enough to get people started. Then they can move on to templates, STL containers, iostreams, etc, once they have a firm grounding. C is easier because it's simpler, only if you assume that 'learn' means 'know every facet of the language'. As your comment above shows, many people use C++ and never learn how templates work, for example.

                                      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                                      J Offline
                                      J Offline
                                      James Brown
                                      wrote on last edited by
                                      #36

                                      Your suggestions that C++ can be taught wrongly, although valid, has no relevance to the point being argued that I can see - C and C++ are different beasts and should be taught in isolation of each other, you will of course agree with this. And I made no comment that people use C++ and never learn templates. Are you implying that *I* am in that category? 'Know every facet'.....hmmm well, semantic arguments will lead nowhere. How about 'learn 10% of each language'? The simple fact remains, C is a simpler language than C++, it is far smaller and is easier to learn because of this.


                                      http://www.catch22.net

                                      C 1 Reply Last reply
                                      0
                                      • E El Corazon

                                        James Brown wrote:

                                        libraries/data structures are irrelevant and never formed a part of my argument

                                        But they are an integral part of WRITING code. Learning the language is only the first step. You are implying that as long as no one ever writes in C, C is always easier to learn. Well... true, but irrelevant, since eventually someone MUST write in it.

                                        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                        J Offline
                                        J Offline
                                        James Brown
                                        wrote on last edited by
                                        #37

                                        El Corazon wrote:

                                        You are implying that as long as no one ever writes in C, C is always easier to learn. Well... true, but irrelevant, since eventually someone MUST write in it

                                        No, I implied nothing of the sort. get over it.


                                        http://www.catch22.net

                                        E 1 Reply Last reply
                                        0
                                        • E El Corazon

                                          James Brown wrote:

                                          Also the many implicit behaviours and side-effects that can be introduced by the most innocent of statement.

                                          the same can be said of pointers and defines, etc, which are a part of C. In fact templates suffer the same issues of writing with defines, only offer some design refinements. Classes are a pointer table of methods which can be written in C, but with greater risk. You can make C completely unreadable too, but it doesn't prove C is evil, it only tells about the programmer. Not knowing C++, of course it would make it unreadable, but knowing C++ well makes it very readable and much more stable.

                                          _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

                                          J Offline
                                          J Offline
                                          James Brown
                                          wrote on last edited by
                                          #38

                                          pointers used within the constraints of the language have no side-effects, and they are also part of C++. #defines, macros, likewise.

                                          El Corazon wrote:

                                          but knowing C++ well makes it very readable and much more stable.

                                          This is a nonsense argument. Knowing C well also makes it very readable and much more stable. So what?


                                          http://www.catch22.net

                                          E 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups