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:

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #40

    In industry you will often find C being used for legacy reasons or in small systems where the tools don't support C++ so well.

    Visit http://www.readytogiveup.com/[^] and do something special today.

    C 1 Reply Last reply
    0
    • E El Corazon

      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 Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #41

      A pompous hot-air balloon a.k.a. a politician :shudder: :suss:


      My Blog[^]

      E 1 Reply Last reply
      0
      • J James Brown

        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 Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #42

        James Brown wrote:

        C and C++ are different beasts and should be taught in isolation of each other, you will of course agree with this.

        Yes, absolutely. The main issue with C++ is that this rarely happens, C is taught and classes are added.

        James Brown wrote:

        And I made no comment that people use C++ and never learn templates. Are you implying that *I* am in that category?

        You made a comment above about templates being too confusing, I thought. If I misread, then no insult was intended, I just thought you'd already said that.

        James Brown wrote:

        The simple fact remains, C is a simpler language than C++, it is far smaller and is easier to learn because of this

        The fact remains that given a *specific* task, C is no easier to learn to perform that task, it simply is less powerful and offers less options in terms of ways to approach it. If pure C code is the best way to tackle a specific problem, then you can write that code in C++. What you said is correct tho, it's what I said. C is smaller, and therefore easier to learn, only if you're talking about how long it would take to learn it completely. An example: I want a program which takes a persons name as text input, then outputs 'Hello, ' followed by the name. Which is easier to teach, memory management in C to create a char *, or iostreams code in C++ which uses the string class ?

        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 1 Reply Last reply
        0
        • J James Brown

          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 Offline
          E Offline
          El Corazon
          wrote on last edited by
          #43

          James Brown wrote:

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

          you said problems with complex programs in C are irrelevant, the primary and unrefutable reason for making C++ in the first place, is irrelevant because you only want to focus on the simplicity of the simpliest program. Data storage is irrelevant because a program will never store or use anything because you want to focus only on the simpliest usage of C, not real-world implimentation issues. libraries, complexites, only the bad behaviors you want to acknowledge are relevant, not the complexities and bad behaviors you don't want to acknowledge... well, sure, if you want to avoid the real-world coding problems, I agree wth you. So again, as long as you never have to write anything sufficiently complex or useful, never have to read anyone else's code, or store, or transmit, or exchange informaton with any routine or program. as long as you never actually do anything with your code, you are correct, C is better. But then... by the same logic, so is Assembly.

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

            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 Offline
            E Offline
            El Corazon
            wrote on last edited by
            #44

            James Brown wrote:

            pointers used within the constraints of the language have no side-effects

            similarly the structures of C++ have no side-effects when used properly. however, since C has no constraints on macros (they are simply compiler pre-processor substitution), it is very easy to have side-effects. Any C programmer of decades could probably provide you with a small book of examples.

            _________________________ 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
            • L Lost User

              James Brown wrote:

              all the object-oriented trappings

              Including Prolog and Smalltalk?

              Visit http://www.readytogiveup.com/[^] and do something special today.

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

              I knew I forgot a language in my list! ... well, at least it was a small one. :laugh:

              _________________________ 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 Ed Poore

                A pompous hot-air balloon a.k.a. a politician :shudder: :suss:


                My Blog[^]

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

                Ed.Poore wrote:

                A pompous hot-air balloon a.k.a. a politician :shudder:

                :wtf::omg::wtf:

                _________________________ 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

                  James Brown wrote:

                  pointers used within the constraints of the language have no side-effects

                  similarly the structures of C++ have no side-effects when used properly. however, since C has no constraints on macros (they are simply compiler pre-processor substitution), it is very easy to have side-effects. Any C programmer of decades could probably provide you with a small book of examples.

                  _________________________ 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
                  #47

                  similarly C++ has no constraints on macros. Structures in C++ *do* have side effects. Do you know what constructors, and destructors are? Your 'argument' makes absolutely no sense whatsoever.


                  http://www.catch22.net

                  E 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

                    P Offline
                    P Offline
                    Paul Conrad
                    wrote on last edited by
                    #48

                    James Brown wrote:

                    C++ is bloated, complicated, and is a horrible hack because it must maintain backward-compatiblity with C.

                    Not so.

                    "The clue train passed his station without stopping." - John Simmons / outlaw programmer

                    1 Reply Last reply
                    0
                    • L Lost User

                      James Brown wrote:

                      all the object-oriented trappings

                      Including Prolog and Smalltalk?

                      Visit http://www.readytogiveup.com/[^] and do something special today.

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

                      Yes, I did prolog for far too long - even psychiatric counselling hasn't helped me get over it :-) Smalltalk, I only studied that very briefly and have very little memory of it.


                      http://www.catch22.net

                      1 Reply Last reply
                      0
                      • C Christian Graus

                        James Brown wrote:

                        C and C++ are different beasts and should be taught in isolation of each other, you will of course agree with this.

                        Yes, absolutely. The main issue with C++ is that this rarely happens, C is taught and classes are added.

                        James Brown wrote:

                        And I made no comment that people use C++ and never learn templates. Are you implying that *I* am in that category?

                        You made a comment above about templates being too confusing, I thought. If I misread, then no insult was intended, I just thought you'd already said that.

                        James Brown wrote:

                        The simple fact remains, C is a simpler language than C++, it is far smaller and is easier to learn because of this

                        The fact remains that given a *specific* task, C is no easier to learn to perform that task, it simply is less powerful and offers less options in terms of ways to approach it. If pure C code is the best way to tackle a specific problem, then you can write that code in C++. What you said is correct tho, it's what I said. C is smaller, and therefore easier to learn, only if you're talking about how long it would take to learn it completely. An example: I want a program which takes a persons name as text input, then outputs 'Hello, ' followed by the name. Which is easier to teach, memory management in C to create a char *, or iostreams code in C++ which uses the string class ?

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

                        Christian Graus wrote:

                        The fact remains that given a *specific* task, C is no easier to learn to perform that task, it simply is less powerful and offers less options in terms of ways to approach it. If pure C code is the best way to tackle a specific problem, then you can write that code in C++.

                        yes, I agree absolutely. I was simply stating that C is simpler to learn than C++, and quite deliberately made no further comment as to which was the better language :-) It's usually much more work to write something in C compared with C++, and for this reason I usually choose C++ (or a subset of) to write things in. Plus the type-safety and all the other good things that the C++ language offers mean that it is much more useful than C. But, it is a right b****rd to learn fully.


                        http://www.catch22.net

                        C 1 Reply Last reply
                        0
                        • J James Brown

                          similarly C++ has no constraints on macros. Structures in C++ *do* have side effects. Do you know what constructors, and destructors are? Your 'argument' makes absolutely no sense whatsoever.


                          http://www.catch22.net

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

                          James Brown wrote:

                          Do you know what constructors, and destructors are?

                          yes, and they have no side-affects. They exist and behave exactly as the definition has them and work quite well. So you obviously don't know how they work since you are now saying they must have side-effects?

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

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

                            you said problems with complex programs in C are irrelevant, the primary and unrefutable reason for making C++ in the first place, is irrelevant because you only want to focus on the simplicity of the simpliest program. Data storage is irrelevant because a program will never store or use anything because you want to focus only on the simpliest usage of C, not real-world implimentation issues. libraries, complexites, only the bad behaviors you want to acknowledge are relevant, not the complexities and bad behaviors you don't want to acknowledge... well, sure, if you want to avoid the real-world coding problems, I agree wth you. So again, as long as you never have to write anything sufficiently complex or useful, never have to read anyone else's code, or store, or transmit, or exchange informaton with any routine or program. as long as you never actually do anything with your code, you are correct, C is better. But then... by the same logic, so is Assembly.

                            _________________________ 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
                            #52

                            El Corazon wrote:

                            you said problems with complex programs in C are irrelevant

                            No, I did not. Learn to read. I *never* said that C was better, or worse than C++. You are reading huge amounts into my simple statement 'C is easier to learn' and are desperately trying to win an argument that doesn't exist, because I made no further comments as to which language was better or more useful.


                            http://www.catch22.net

                            1 Reply Last reply
                            0
                            • E El Corazon

                              James Brown wrote:

                              Do you know what constructors, and destructors are?

                              yes, and they have no side-affects. They exist and behave exactly as the definition has them and work quite well. So you obviously don't know how they work since you are now saying they must have side-effects?

                              _________________________ 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
                              #53

                              once again, you are making absolutely no sense. I did *not* say that constructors and desctructors have side effects. Your attempt at reasoning appears to be non-existant. I have nothing further to say to you.


                              http://www.catch22.net

                              1 Reply Last reply
                              0
                              • J James Brown

                                Christian Graus wrote:

                                The fact remains that given a *specific* task, C is no easier to learn to perform that task, it simply is less powerful and offers less options in terms of ways to approach it. If pure C code is the best way to tackle a specific problem, then you can write that code in C++.

                                yes, I agree absolutely. I was simply stating that C is simpler to learn than C++, and quite deliberately made no further comment as to which was the better language :-) It's usually much more work to write something in C compared with C++, and for this reason I usually choose C++ (or a subset of) to write things in. Plus the type-safety and all the other good things that the C++ language offers mean that it is much more useful than C. But, it is a right b****rd to learn fully.


                                http://www.catch22.net

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

                                OK - this I agree with 100%. I guess we were trying to say the same things, or at least things that were not opposed :-)

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

                                  OK - this I agree with 100%. I guess we were trying to say the same things, or at least things that were not opposed :-)

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

                                  :)


                                  http://www.catch22.net

                                  1 Reply Last reply
                                  0
                                  • C Christian Graus

                                    C is like C++, with the fun removed. C++ is built on C, precisely so that it keeps the power of C, and so the language was likely to survive. C ruled the roost at the time. C may be a little faster, but not much. IMO, you'd be hard pressed to find a platform where C is sufficiently faster to warrant how much harder it is to write and maintain C code.

                                    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 )

                                    P Offline
                                    P Offline
                                    Paul M Watt
                                    wrote on last edited by
                                    #56

                                    embedded devices with limited resources, DOS my company develops applications for hand held portable devices that run windows CE and DOS. We are at our limit on what will fit in the executable. We have to keep C++ out of the code that will run on DOS.

                                    1 Reply Last reply
                                    0
                                    • L Lost User

                                      In industry you will often find C being used for legacy reasons or in small systems where the tools don't support C++ so well.

                                      Visit http://www.readytogiveup.com/[^] and do something special today.

                                      C Offline
                                      C Offline
                                      Code2326
                                      wrote on last edited by
                                      #57

                                      #include using namespace std; int main() { cout<<"The person who told me that C does more than C++ came from the Robotics Team\n"; cout<<"and that C is the preferred choice for development.\n"; cout<<"Note: This is FIRST (usfirst.org), it is a regular High\n"; cout<<"School Club/Team, not something major like developing a product for the public.\n"; cout<<"Thanks for the input everyone.\n"; cout<<"Press Enter to Close Program.\n"; cin.get(); } Hmmmm....I don't think I'm that great of a programmer. :~ Could I have written that program better?

                                      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
                                        Jim Crafton
                                        wrote on last edited by
                                        #58

                                        I'll take a stab! -Lack of a native, built in String type -Lack of any awareness of size of a dynamically allocated array -No understanding (at run time) of the difference between a pointer to an object (like a struct or class or primitive) and an array -dippy syntax that makes writing front end parsers (such as one would use for building analysis tools like lint, or a tool to generate class diagrams, etc) a total nightmare. C++ is one of the most difficult language to write a parser for when using tools like lexx/yacc/antlr, etc due to the convoluted syntax, which is why traditionally these tools have been lacking and slow to get built by the development community. I can't emphasize this enough -total lack of C++ Application Binary Interface (ABI) standard resulting in a total mess, and complete incompatibility between compilers -no real, useful RTTI, not even anyway to "toggle" it on or off via pragma, or compiler flags -a total lack of courage within the top tiers of the C++ community (hey Bjarne!) to publicly stand up and legitimately criticize vendors for poor compiler implementations.

                                        ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                                        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
                                          Lost User
                                          wrote on last edited by
                                          #59

                                          C++ is superset of C and can do everything C can. However the difference between the current C language and C++ isnt so great as you might think so the superset that C++ is is only a bit bigger than C.

                                          Truth is the subjection of reality to an individuals perception

                                          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