Thread: why not ++?

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    C being the lowest of all languages, there probably isn't anything you "cannot" do.
    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. #17
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Elysia View Post
    C being the lowest of all languages, there probably isn't anything you "cannot" do.
    Exactly!

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    But the points above are still valid. It's just bloody difficult to accomplish some things in C. Which is my point. It can be done, but it sure won't be easy, and it won't be fast, or pretty.
    So if we want to fix those points, we need higher-level languages. If not, then why do we need C when we have assembly?
    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.

  4. #19
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by Elysia View Post
    But the points above are still valid. It's just bloody difficult to accomplish some things in C. Which is my point. It can be done, but it sure won't be easy, and it won't be fast, or pretty.
    So if we want to fix those points, we need higher-level languages. If not, then why do we need C when we have assembly?
    I agree that higher level languages do tend to be easier and faster, no argument there at all.

    However this began with the assumption that everyone who knows C magically knows C++ and the rather bold statement that because of that C was useless... My whole point was that it isn't useless and a careful programmer can still do whatever the higher languages do in C.

    Ahhh yes ASM... my old friend from the z-80 days... Wrote entire system diagnostics in that then got stuck with the upkeep because nobody could read the source... such fond memories...

  5. #20
    Registered User NeonBlack's Avatar
    Join Date
    Nov 2007
    Posts
    431
    There seems to be some deep-seated, irrational idealogical or emotional hatred towards C++, particularly in, but not limited to the open source *ahem* "community". Just read some of the things Linus Torvalds has said regarding C++. "Converting" C to C++ does not require converting procedural code to object oriented code. C++ is a multiparadigm language that allows you to mix these.

    This flexibility is one of the reasons I believe that given the choice, there is no reason to choose pure C over C++ in a new project, however moving to C++ in an existing project, depending on size and maturity, is probably not worth the work.
    I copied it from the last program in which I passed a parameter, which would have been pre-1989 I guess. - esbo

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Linus Torvalds is known to be a C++ pessimist and hater. Nothing good about C++ comes from that man's lips. It's better to ignore him.
    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.

  7. #22
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by NeonBlack View Post
    There seems to be some deep-seated, irrational idealogical or emotional hatred towards C++, particularly in, but not limited to the open source *ahem* "community". Just read some of the things Linus Torvalds has said regarding C++. "Converting" C to C++ does not require converting procedural code to object oriented code. C++ is a multiparadigm language that allows you to mix these.

    Yeah. The criticism is always misguided. It's spreads through viral hearsay in the Linux community in general and the open source community in particular (although both have supporters of C++), often by people who don't actually know much of what they are talking about (aka, people who don't actually program much, or program at all, in C++).

    It usually starts with an honest and accurate criticism of something about C++. But it is then quickly generalized by the monkey-see-monkey-doers, by force of libel and with the confidence of someone who knows will be saying something that is popular among their community.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  8. #23
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    Don't you people get tired of discussing C vs C++ so many times? I got tired of the topic years ago just by reading other people's discussions about it. Now every time someone asks me about it, I say: "It's personal preference. Nothing more to talk about." You can point out some advantages and disadvantages, but in the end you come back to the same conclusion. You can also look at statistics, but that doesn't show anything else than what the masses do. If someone asked me why I wrote one thing in C and the other in C++, I'd just answer "That's the way I like it." Google already gives people hundreds of arguments on the topic, I don't feel like wasting my time to analyze my tastes.

    I'm not saying it's completely useless to talk about it, but seriously, isn't everything that can be said already said a million times?
    Last edited by maxorator; 11-26-2010 at 03:55 PM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  9. #24
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Awww, let people have their fun. It makes for interesting read if nothing else.
    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.

  10. #25
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by NeonBlack View Post
    There seems to be some deep-seated, irrational idealogical or emotional hatred towards C++, particularly in, but not limited to the open source *ahem* "community".
    Well, I can't speak for Open Sourcers... but I have a whole whack of pascal libraries I spent months and months converting to C ... I'll be darned if I'm going to conver them again! Plus I've tried C++ a bunch of times and for reasons unknown, just can't get my head to think OOP...

    Now procedural C, this I get... But crash and burn on both Delphi and C++... This old noggin just don't work that way.

  11. #26
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by Elysia View Post
    That is not correct.
    C and C++ are tied for speed. C is better in some areas, C++ in others.
    I don't really think you can say that one is faster than the other when the speed of the code depends on how well the compiler optimizes your code. It's really compiler vs. compiler.

    Computer Language Benchmarks Game reflects what you say, i.e. C is faster in only some areas, but take a look at the distributions...somehow C++ has a much, much smaller standard deviation. Since both languages end up as machine code in the end, it's apparent that g++ does a better job of optimizing than gcc.

  12. #27
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Quote Originally Posted by Salem View Post
    As for being trivial, read this -> Incompatibilities Between ISO C and ISO C++
    After reading through the first couple of parts, it looks to be more of a comparison of C90 with C99 than anything else. It looks like C99 upgraded C to a point that is mostly compatible with C++.

  13. #28
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    What I find most funny about these benchmarks is that the authors make a point of saying how flawed they are, but go around and do them the same. It's an exercise in stupidity. A poor ability to understand or profit from experience.

    Or instead plain and simple hypocrisy. As in, "we know there are these VERY IMPORTANT flaws on any benchmark of this nature, but while we are going to tell you about them so you get a feeling we know what we are doing, we don't actually give a damn and will still publish results of said benchmarks".
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  14. #29
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Epy View Post
    I don't really think you can say that one is faster than the other when the speed of the code depends on how well the compiler optimizes your code. It's really compiler vs. compiler.

    Computer Language Benchmarks Game reflects what you say, i.e. C is faster in only some areas, but take a look at the distributions...somehow C++ has a much, much smaller standard deviation. Since both languages end up as machine code in the end, it's apparent that g++ does a better job of optimizing than gcc.
    No, it's not compiler vs compiler. It's about language features.
    For example, take the standard library sort. Now, run it, say, 10^9 times. In both C (eg qsort) and C++ (std::sort). Which will be faster? C++, hands down. No doubt about that.

    Now, take a hand-written, hand-optimized sort by a guru and compare it to C++'s std::sort. Run it 10^9 times. Which one wins? Probably C in this case.

    The thing is that there are some things--like templates--that allow C++ to do things that C cannot. But with C, you usually roll out your own optimized solutions for a specific case, and they are sometimes going to more efficient, giving C the trophy in this case. This could be done in C++, but usually isn't, because we want to achieve more genericism.
    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.

  15. #30
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Elysia View Post
    But with C, you usually roll out your own optimized solutions for a specific case, and they are sometimes going to more efficient, giving C the trophy in this case. This could be done in C++, but usually isn't, because we want to achieve more genericism.
    This can't be done in C since it doesn't share a relationship with C++, the same way C++ does with C. This is an advantage of C++, as indeed I can insert C code in my project and have that specific part be compiled by the C compiler, while the rest is dealt with by the C++ compiler.

    However these type of situations are mostly only for academics or for very specialized situations which don't represent the vast majority of programmers' concerns. More commonly we simply don't care which one is faster given that both languages offer a performance window that more than suits the vast majority of tasks.

    ... and as do many other languages. All the mainstream languages do, for sure.
    Last edited by Mario F.; 11-29-2010 at 07:57 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

Popular pages Recent additions subscribe to a feed