4 ms·
The STL is just a marvel and AFAIK C++ is the only language providing such a generic library. Every time I tell someone about how marvelous the STL is I hear "
by shin_lao 17y ago
The STL is just a marvel and AFAIK C++ is the only language providing such a generic library.
Every time I tell someone about how marvelous the STL is I hear "yeah we have lists and maps in X language as well, C++ sucks".
The list I read in:
http://www.yosefk.com/c++fqa/defective.html http://www.yosefk.com/c++fqa/defective.html
I realize the guy thinks "object oriented" too much. IMHO 2009 C++ is tailored for generic programming and meta programming. If you try to do C#/Java in C++, yes, you're going to bleed.
C++ is a multi-paradigm language, but it shines when you go generic. You can do incredible things.
And then I stumbled upon this:
"For example, overloaded operators have to return their results by value"
Wrong. The author doesn't understand the difference between, value, reference and pointer in C++. He doesn't understand copy elision. He doesn't understand operator overloading as well and when he talks about smart pointers he says you have to rely on defective (?!) meta programming features (?!). How, I thought I simply had to use std::shared_ptr.
C++ is hard. Because it's made to solve very hard problems.
And yes, you can solve these problems in C, you can also solve them in assembly while you're at it.
C++ bad reputation comes from people who should never have been in contact with the language in the first place.
- ilyak 17y agoYou should've noticed three things before writing it: 1) His background is C++/Embedded. 2) He does that successfully for a living. 3) He really knows what he's talking about. This leads me to a conclusion: Maybe the subject of your last phrase is YOU?
- wynand 17y agoThe parent is right about the copy elision part (http://en.wikipedia.org/wiki/Return_value_optimization http://en.wikipedia.org/wiki/Return_value_optimization). GCC definitely performs this and I'm sure that it's true of other widely used C++ compilers. I also don't know what yosefk means when he says that smart pointers rely on defective meta-programming techniques. The implementation of Boost's smart_ptr doesn't seem too esoteric to me.
- shin_lao 17y agoMore information about copy elision here: http://cpp-next.com/archive/2009/08/want-speed-pass-by-value/ http://cpp-next.com/archive/2009/08/want-speed-pass-by-value...
- deleted 17y ago[deleted]
- chancho 17y agoSo is this how "appeal to authority" works in language pissing contests? The "authority" is money? "I make money using this language so blah blah blah QED."
- ilyak 17y agoNo, this is how refutations to "he doesn't know anything" work.
- Dellort 17y agoYou stay with C++, I want a language I can master entirely. No subset restrictions.
- shin_lao 17y agoWhich language do you have in mind?
- Dellort 17y agoWho knows, I'll rather use a mixture of languages than C++. C combined with other languages will suffice for now, as most of them are simple enough to understand entirely.
- chancho 17y agoJust one language? Of course not that's selling yourself short. Surely, with great effort and many years, you can master many languages, and use them masterfully in concert like many do with C and Python. And if you can do that then you can master the many faces of C++. Maybe you just don't need to.
- Confusion 17y agoIMHO 2009 C++ is tailored for generic programming and meta programming That was not the design goal and it was not how C++ was marketed by Stroustrup or anyone else. You cannot shift the blame onto people that are using the language as it was intended and marketed. The blame lies with C++. That it seems to be perfect for generic and meta programming is nice, but an unintentional side effect. However, what use are generic and meta programming without a sane range of 'regular' programming capabilities?
- chancho 17y agowhat use are generic and meta programming without a sane range of 'regular' programming capabilities? C++ contains C. How can it not contain a sane range of 'regular' programming capabilities? (Of course in this context, 'regular programming capabilities' does not refer to web apps so let's just avoid that whole argument and take for granted that C is a useful language.) This is a great instance of two (maybe 3) arguments against C++ canceling each other out: On the one hand, C++ sucks because it's wed to C and inherits all it's legacy warts. Anyway, C is a better C++ because it's simpler. And yet, as you claim, C++ offer's no useful core of functionality on which layer all the generic templately goodness.
- Confusion 17y agoC++ contains C. Unfortunately, you cannot just use C++ as if it were C, because some of these FQA's will still trip you up. The point of this FQA and other recents C++ criticisms is that you have to choose a specific subset and still be wary of all 'unexpected' things that happen in that subset.
- blub 17y agoWhat FQA's will trip you up if you want to compile "clean C" (i.e: the C and C++ subset)?
- blub 17y agoC++ is marketed by Stroustrup as a multi-paradigm programming language and this was its design goal from the beginning. Generic programming was a design goal, not a side effect. Regular programming capabilities are abundant with the CRT and OOP. In short, all your statements are incorrect.
- rikthevik 17y ago"C++ is hard. Because it's made to solve very hard problems." What the hell does that mean? If it's Turing complete, it'll solve your hard problems. I don't understand how making a language inconsistent and obtuse makes it a good tool. So you spend a year figuring out all the gotchas that will make you leak and corrupt memory. Great, now it's time to start getting some work done!