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.
  • J James Brown

    C is simpler, cleaner and easier to learn. C++ is bloated, complicated, and is a horrible hack because it must maintain backward-compatiblity with C.


    http://www.catch22.net

    L Offline
    L Offline
    leckey 0
    wrote on last edited by
    #4

    Out of curiosity, which did you learn to program first?

    _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

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

      L Offline
      L Offline
      leckey 0
      wrote on last edited by
      #5

      I think some people learned C first and therefore are more comfortable. Some people don't like to change. C++ is the language I mainly focused on in college but we did some C work. (We had a class where every program had to be written in C, C++, Pascal and FORTRAN.) I like C++ more because I'm just more comfortable with it.

      _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

      1 Reply Last reply
      0
      • J James Brown

        C is simpler, cleaner and easier to learn. C++ is bloated, complicated, and is a horrible hack because it must maintain backward-compatiblity with C.


        http://www.catch22.net

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

        It *is* simpler, as C++ adds to C. It is cleaner, if you don't understand OO. It's not easier to learn, no way. Only if C++ is taught *wrong* is it easier to learn C.

        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 )

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

          R Offline
          R Offline
          Rama Krishna Vavilala
          wrote on last edited by
          #7

          For me There is no convincing reason at all. Some people claim that it is performance but you can write C style code in C++ and especially from the perspective of Microsoft Visual C++, C code and C style code written in C++ code lead to same assembly code. I have not seen any difference. PS: I hope you are not Kyle.

          1 Reply Last reply
          0
          • L leckey 0

            Out of curiosity, which did you learn to program first?

            _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

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

            I taught myself C first of all, then was formally taught C++ at University along with all the object-oriented trappings.


            http://www.catch22.net

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

              C Offline
              C Offline
              Chris Losinger
              wrote on last edited by
              #9

              because C++ is a superset of C, C is simpler. but that's about all it has going for it. unless you have some kind of unfortunate restraint (legacy code, legacy co-workers, no C++ compiler for the platform, etc.), there's no good reason to choose C over C++.

              image processing toolkits | batch image processing | blogging

              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
                Chris Austin
                wrote on last edited by
                #10

                I first learned to program with C++ and later did some system programming in C. Based on the assumption that I must work with or the other; my personal opinion is that the C syntax is much cleaner and I prefer working with it over C++. That being said, I doubt you are going to find much work outside of the embedded and device world. I've never really attempted or cared about benchmarks comparing the two languages so I honestly cant speak about performance comparisons.

                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

                1 Reply Last reply
                0
                • J James Brown

                  I taught myself C first of all, then was formally taught C++ at University along with all the object-oriented trappings.


                  http://www.catch22.net

                  L Offline
                  L Offline
                  leckey 0
                  wrote on last edited by
                  #11

                  I've noticed that whichever one learns first, seems to be the preference. What about C++ bothers you the most?

                  _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

                  E J J 3 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:

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

                    Code2326 wrote:

                    I was told C could do more than C++

                    Neither can do more than the other. Any class can be written in C, but the difference is ease of organization and definition of structure. Just as patterns define common operations, classes provided the first standard for organization of programming methodology for C, thus C plus plus, being C plus more. Given that there was no standard for organizational structure libraries were often disjointed, having no coherent "glue" to hold them together. C++ is not inherently slower, but some operations are inherently slower, so knowledge is best. For instance, never using a virtual method for a commonly called routine in a program that needs speed. Minimizing nesting of inheritance, as well as classes with classes as members. Nesting is an important part of organizational structure, but just as writing API functions that call smaller API functions which called smaller API functions, which called smaller API functions, you can easily go to far. Your brain is the best optimization/organization tool, used correctly with C/C++ both are fast. C++ has then the organizational coherence of a standard method and storage containers. No more writing a linked list, though I miss a skip-list.... No more organization of routines wth functon pointers, classes provdide an easier to maintain standard. if you write a class using all virtual functions and deep inheritance and circular inheritance you can prove that C++ is slower... but since this is poor practices in the first place, all you are doing is proving why it s a poor practice, nothing about the language itself. You can just as easily build an API with nested calls, deep recursion, and no more than 2 lines of code in every function, the resulting stack calls will eat all your performance. Everything has a cost, knowing that cost is the first step to programming for performance. Balancing that performance cost and development/organization cost is something that comes with experience. We have constant arguments here, that organizaton should outweigh performance in all cases. I disagree, I believe they are both important. C++ is neither a miracle, nor a curse, it is a technological advancement of the language of C for multiple reasons. If you know and understand those reasons you have an extra tool in your brain for application of C++ structures.

                    _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about t

                    1 Reply Last reply
                    0
                    • L leckey 0

                      I've noticed that whichever one learns first, seems to be the preference. What about C++ bothers you the most?

                      _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

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

                      leckey wrote:

                      I've noticed that whichever one learns first, seems to be the preference.

                      Although that is the majority of human nature, it still is not always true. :) Basic->Fortran->Pascal->(first attempt at C)->S-Basic->Cobol->RPG-II->Modula->LISP->Prolog->Forth->C->Assembly->Ada->C*->C++->C# I am sure I left out a few in there, but I still prefer C++.

                      _________________________ 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
                      • C Christian Graus

                        It *is* simpler, as C++ adds to C. It is cleaner, if you don't understand OO. It's not easier to learn, no way. Only if C++ is taught *wrong* is it easier to learn C.

                        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 )

                        C Offline
                        C Offline
                        Chris Austin
                        wrote on last edited by
                        #14

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

                          N Offline
                          N Offline
                          Nirosh
                          wrote on last edited by
                          #15

                          They are afraid of/ don't like the change. Just like those people who use the same pen continuously for quite a long time, and even after it is over, still want to keep the old one aside with the new one.

                          L.W.C. Nirosh. Colombo, Sri Lanka.

                          1 Reply Last reply
                          0
                          • L leckey 0

                            I've noticed that whichever one learns first, seems to be the preference. What about C++ bothers you the most?

                            _____________________________________________ Flea Market! It's just like...it's just like...A MINI-MALL!

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

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

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

                              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 1 Reply Last reply
                              0
                              • C Christian Graus

                                It *is* simpler, as C++ adds to C. It is cleaner, if you don't understand OO. It's not easier to learn, no way. Only if C++ is taught *wrong* is it easier to learn C.

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

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

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