Live data from Hacker News

Why C++ is vastly superior to C

warp.povusers.org

11–20 of 123 posts

Re: Why C++ is vastly superior to C

#11
post #3

I know that C++ has some pretty neat features, but I feel comfortable and productive enough in C. I have never really felt that there was anything in C++ that I just had to have. If I need to something higher level there are plenty of choices of that already, and C is a great language for extending applications done in a higher level language. I think that the author has some good points. but I think both languages h…

> If C++ was really "vastly superior" to C then why are so many people still using C and using it productively?

Why are so many people using Java (perhaps even more than C and C++ combined)? Does it make a good language? Absolutely not. In the case of such simplistic languages as C and Java, it's their simplicity that makes them a popular choice.

Productivity: I am not sure all the C folks are as productive as they could've been if they switched to C++. Same people.

The complexity of C++ is not only in the amount of new concepts compared to C, it is also in greater risks of producing bloated binaries. Too much knowledge and caution is required to keep C++ code maintainable in this regard. That's a drawback, but if you ask me, I'd never give up RAII, implicit destruction and exceptions for C; I'd rather understand them better in order to use them properly.

And finally, the article would look much nicer without the insults closer to the end.

Re: Why C++ is vastly superior to C

#13
post #6

Why C is vastly superior to C++: $ cat > foo.c #include int main(int argc, char**argv){ puts("hello world"); return 0; } ^D $ cat > foo.cxx #include int main(int argc, char**argv){ std::cout

Great job measuring initialization time, now how about showing real world performance differences in actual large programs.

That's compilation time, not initialization time. Compiling C++ is tremendously slow compared to compiling C programs of equivalent complexity, and is a real issue even on modern hardware.

Re: Why C++ is vastly superior to C

#14

For some things, C++ is better than C. For some things Lisp is better than either, and for yet other things, Python is better than them all. Why are people so insistent on declaring their view is absolutely right, with no arguments, everyone else is wrong, and that one language will rule them all? Trust me. For some things I do, C is vastly superior to C++, but I'm not going to try to convince everyone that C is bett…

I don't think this article is about declaring C++ the ruler of all languages. If you have an example of C being a better fit for a problem than C++, feel free to share it.

Embedded systems, 128 bytes of RAM. I really do just want portable assembly.

Re: Why C++ is vastly superior to C

#15
post #6

Why C is vastly superior to C++: $ cat > foo.c #include int main(int argc, char**argv){ puts("hello world"); return 0; } ^D $ cat > foo.cxx #include int main(int argc, char**argv){ std::cout

Great job measuring initialization time, now how about showing real world performance differences in actual large programs.

It is not about initialization time or even run-time performance, but about speed of compilation. When any non-trivial program in C++ takes minutes to build even on high end workstation all benefits that might come from it's "high level" features are moot.

Re: Why C++ is vastly superior to C

#16

For some things, C++ is better than C. For some things Lisp is better than either, and for yet other things, Python is better than them all. Why are people so insistent on declaring their view is absolutely right, with no arguments, everyone else is wrong, and that one language will rule them all? Trust me. For some things I do, C is vastly superior to C++, but I'm not going to try to convince everyone that C is bett…

I don't think this article is about declaring C++ the ruler of all languages. If you have an example of C being a better fit for a problem than C++, feel free to share it.

> If you have an example of C being a better fit for a problem than C++, feel free to share it.

http://www.kernel.org/pub/linux/kernel/v2.6/

Re: Why C++ is vastly superior to C

#18
post #12

is this an inflammatory troll submission?

No, I just see it taken for granted in most places that C++ was a mistake. The "general wisdom" is that C++ is too complicated for its own good and shouldn't be used for anything big (the C++ FQA is frequently cited). An article advocating the opposite position is nice.

Re: Why C++ is vastly superior to C

#19
Apart from "use the right tool for the job", I always did wonder how C programmers cope without the STL containers: std::vector, std::list, std::set, std::map etc.

Sometimes I need to map a string to a list of numbers. std::map >. Done. All memory allocation taken care of for you as well - nothing to leak. In C, how do you get by? You either have to reinvent a red-black tree each time you want that, or use some kind of type-unsafe macro horror, or just not use that data structure.

That seems to be a significant point of the article as well. Any C programmers care to enlighten me on this? Nowadays I couldn't code for long in C without thinking "screw this, I want a vector" and going back to C++.

Re: Why C++ is vastly superior to C

#20
post #7

When the argument is that C++ has too many features that interact in unpredictable ways and are virtually impossible to get right, arguing that C++ is superior because it has more features is perhaps a fine argument in some hypothetical universe in which the primary objection to C++ is that it is missing features, but by failing to grapple with the points raised by the opposition in the real universe, you will fail t…

What are some of these C++ features that interact in unpredictable ways? Just curious.
Post reply on HN