C or C++

This is a discussion on C or C++ within the General Discussions forums, part of the Community Boards category; Originally Posted by sean Which is about as valid an argument as the most efficient OS kernels in the world ...

  1. #31
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Quote Originally Posted by sean View Post
    Which is about as valid an argument as the most efficient OS kernels in the world being written in C and their mailing lists abhorring C++. That sector of the industry has made their choice for certain reasons, but it has absolutely no bearing on "which language is better", or "which I should learn" unless the person asking the question specifies a LOT more about what they want to do.
    Of course not, but I think it would prove that for such large scale performance projects, they chose C++ for a reason over C.
    Because in some stuff C++ has an edge over C.

    Let us summarize some key traits of C++ and C.
    C++:
    + Much more functionality and flexibility than C.
    + High-level abstracts that makes it faster and easier to create certain type of code.
    + More beginner friendly than C.
    - Not as portable as C.

    C:
    + More portable than C++.
    - Not as much functionality as C++.
    - Less beginner friendly than C++.

    Feel free to add or disagree with certain cons/pros.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #32
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by Elysia
    there IS a reason why games are written in C++ and not C,
    I believe (not being one myself) that many game companies have library packages that are written in C -- For the fast graphics libraries, is this not so? Are there not wrappers for these "low level" functions for C++? <<== Now, this is purely speculation as I am NOT a game programmer, but I believe that the majority of packages I have seen are based upon OpenGL and/or other such libraries. If I am misinformed on this matter, please correct me.

  3. #33
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >+ Much more functionality and flexibility than C.
    Since it's really a perspective thing, I'll restrain myself from disagreeing with this.

    >+ More beginner friendly than C.
    I'm not sure I'd agree with this as a blanket statement. C++ has more "magic" going on which is distinctly not beginner friendly. In terms of being able to do more right out of the gate, C++ probably is more beginner friendly, but it also requires more faith. You might want to qualify this particular pro of C++.
    My best code is written with the delete key.

  4. #34
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    My starter language was QBASIC (with the line numbers) -- then the "real" first language was Pascal. C was still fairly new and didn't have a widely published standard (late 80's). C++ wasn't around until much later for me. I tried it but could never get a "warm and fuzzy" about the way I/O was handled -- What the CRAP is this cout/cin thingy anyway. I found, however, that I could still use my good ole printf/scanf. Now, that I can use these in C++ is pretty cool, but, am I not still writing C code just with a .cpp extension?

    For me, C was VERY beginner friendly since it was the 3rd language I learned (the second was i386 assembly). C++ was a major jump for my thought processes and completely was against the way I know to do things.

    Also, both C and C++ are extremely portable -- I don't get why you think it isn't?

    > + High-level abstracts

    CONFUSE THE SNOT out of me. I cannot stand it. Let me deal with the trees, then I can take care of the whole forest. Don't make me just look at the forest not the trees.

    > + Much more functionality and flexibility than C.

    Pass me that crack pipe when you are done.

    You cannot truly believe this? Neither is more or less functional than the other. Whereas you may not be able to make C do things you want it to do, I can. On the other hand, I don't know that I could successfully write a "hello World" in C++ .

    It is completely a matter of choice -- this goes back to that thing of you cannot compare these two like that, nor any other language. It is purely a matter of preference.

  5. #35
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Quote Originally Posted by Prelude View Post
    >+ Much more functionality and flexibility than C.
    Since it's really a perspective thing, I'll restrain myself from disagreeing with this.
    People, people, people. This is truth. It has more functionality and flexibility than C.
    Now, whether you want or need it is another thing entirely.
    Saying that c++ does not have more flexibility and functionality than C is like saying that assembly has more functionality and flexibility than C.

    >+ More beginner friendly than C.
    I'm not sure I'd agree with this as a blanket statement. C++ has more "magic" going on which is distinctly not beginner friendly. In terms of being able to do more right out of the gate, C++ probably is more beginner friendly, but it also requires more faith. You might want to qualify this particular pro of C++.
    Right out of the box, for a newbie for programming, I would definitely call C++ easier since they do not have to worry about the low-level stuff right off the bat.

    Quote Originally Posted by Kennedy View Post
    Also, both C and C++ are extremely portable -- I don't get why you think it isn't?
    Yes, they are, of course. But C is more so than C, since there are some platforms where a C++ compiler does not exist.

    > + High-level abstracts
    CONFUSE THE SNOT out of me. I cannot stand it. Let me deal with the trees, then I can take care of the whole forest. Don't make me just look at the forest not the trees.
    You are not required to use them, but the functionality being there is a not bad thing. It is a good thing in case you need it.

    > + Much more functionality and flexibility than C.
    Pass me that crack pipe when you are done.

    You cannot truly believe this? Neither is more or less functional than the other. Whereas you may not be able to make C do things you want it to do, I can. On the other hand, I don't know that I could successfully write a "hello World" in C++ .
    Neither is more functional than the other, but C++ has more functionality built into the language. Classes, for example, are supported natively, while they must be emulated in C. Hence C++ has more functionality. This does not mean it could not be done in C with some more work, however. But some things, like templates, are difficult, if not impossible to do in C.

    It is completely a matter of choice -- this goes back to that thing of you cannot compare these two like that, nor any other language. It is purely a matter of preference.
    Do not get me wrong. They are a matter of choice. Neither are better than each other in that sense. But language-wise, functionality-wise, would you not say something is better than the other?
    Like an electric screwdriver is probably better functionality-wise than a normal screw-driver, but it does not mean it is the best tool there is. That is subjective.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #36
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by Elysia
    People, people, people. This is truth. It has more functionality and flexibility than C.
    Now, whether you want or need it is another thing entirely.
    Saying that c++ does not have more flexibility and functionality than C is like saying that assembly has more functionality and flexibility than C.

    Quote Originally Posted by Elysia
    Do not get me wrong. They are a matter of choice. Neither are better than each other in that sense. But language-wise, functionality-wise, would you not say something is better than the other?
    Like an electric screwdriver is probably better functionality-wise than a normal screw-driver, but it does not mean it is the best tool there is. That is subjective.
    So, is the word contradiction in your lexicon?

  7. #37
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >People, people, people. This is truth. It has more functionality and flexibility than C.
    Then define what you mean by "functionality", what you mean by "flexibility", and prove it. Stomping around waving your opinion and calling it truth without any substantiation isn't productive, especially when you use ambiguous terms.

    >Saying that c++ does not have more flexibility and functionality than C is
    >like saying that assembly has more functionality and flexibility than C.

    Actually, that makes perfect sense to me. C has the same depth and breadth as C++. Thus, they are equally functional and equally flexible. Assembly has slightly more depth than both C and C++, so it is slightly more functional but equally flexible. Next!
    My best code is written with the delete key.

  8. #38
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    *shrug* Then what is the point in expanding what I mean? I will just leave it be.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #39
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I tried it but could never get a "warm and fuzzy" about the way I/O was handled -- What the CRAP is this cout/cin thingy anyway. I found, however, that I could still use my good ole printf/scanf. Now, that I can use these in C++ is pretty cool, but, am I not still writing C code just with a .cpp extension?
    Use C I/O functions all you want, but remember that there are some cases where they leave you helpless (in templated code because of the type safety thing).

    I see C sometimes favoured by beginners, and the reason is that higher levels of abstractions are harder to get, so because of the understanding issues they'll find it easier to do things the hard way. Similarly, beginners tend to find it easier to use goto and all globals instead of structured control statements and argument passing / return values.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  10. #40
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Saying that c++ does not have more flexibility and functionality than C is like saying that assembly has more functionality and flexibility than C.
    Assembly DOES have more functionality and flexibility than C. You can't write a boot loader in C. You can't specify the arrangement of data within a struct in C.

  11. #41
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Then you are misinterpreting my words.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #42
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Then you are misinterpreting my words.
    Fair enough. What is your definition of the word flexible and functional, then? I get that C++ generally deals with a higher-level of abstraction, but that really has nothing to do with flexibility and functionality. You can implement closures in C, you can have an OOP style in C, it all depends on the programmer.

  13. #43
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    ...OO as the single most important aspect of high quality software.
    ...and the single biggest excuse for slipping deadlines.

  14. #44
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,610
    Quote Originally Posted by Elysia View Post
    Saying that c++ does not have more flexibility and functionality than C is like saying that assembly has more functionality and flexibility than C.
    Quote Originally Posted by sean View Post
    Assembly DOES have more functionality and flexibility than C. You can't write a boot loader in C. You can't specify the arrangement of data within a struct in C.
    Quote Originally Posted by Elysia View Post
    Then you are misinterpreting my words.
    Perhaps you really have misspoken, as most were interpreting your words according to standard English definitions?
    Quote Originally Posted by wordnetweb.princeton.edu/perl/webwn
    the property of being flexible; easily bent or shaped

    capable of serving a purpose well; "software with greater functionality"
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  15. #45
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,554
    Quote Originally Posted by Yarin View Post
    Perhaps you really have misspoken, as most were interpreting your words according to standard English definitions?
    Perhaps I was.

    Quote Originally Posted by sean View Post
    Fair enough. What is your definition of the word flexible and functional, then? I get that C++ generally deals with a higher-level of abstraction, but that really has nothing to do with flexibility and functionality. You can implement closures in C, you can have an OOP style in C, it all depends on the programmer.
    What I meant is that C++ have things such as templates, OOP, classes, etc, etc.
    Yes, you can emulate these in C, but it is not as easy as if they were natively supported. So if you do not have to invent a solution to get it working right, it might be safe to say that it is faster, usually easier and less error-prone to use them than to emulate them.
    Assembly supports even less of such things than C. It does not even feature high-level syntax and statements such as ifs.
    This is what I meant with C++ having more "features".
    I think of it as having more tools available at the tips of the programmer, allowing us to get things done faster. The later part is subjective, of course.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Page 3 of 5 FirstFirst 12345 LastLast
Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21