
C++ Frequently Questioned Answers - jacquesm
http://www.yosefk.com/c++fqa/
======
shin_lao
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>

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
You 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
The parent is right about the copy elision part
(<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
More 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/)

------
parenthesis
Extensive previous discussion: <http://news.ycombinator.com/item?id=602981> .

------
allending
What is the point of making this almost religious? Ok, C++ sucks. Now what? I
know it's shocking but you will find similar criticisms for any other language
out there. Just keep an open mind and use the right tool for the job and
circumstances at hand. Sometimes it may be something you are uncomfortable
with. Do you want to be a programmer or do you want to be a java/c++/python
programmer?

~~~
wglb
I agree with jacquesm--see the humor, but take it as cautionary. I did 12
years of C++ and it helps to take the 20% cut. If you look at google's coding
standards you can see the restrictions that they put into place.

Few modern languages get as much criticism as C++, and I think rightly so. It
is very complex, and takes way to long to master.

Think of the FQA as a survival guide.

~~~
biotech
_If you look at google's coding standards you can see the restrictions that
they put into place._

Keep in mind, though, that reasons for many of those restrictions have to do
with maintaining compatibility. This may not be as much of an issue with newer
projects.

OTOH, Google's coding standards is probably the most thorough, well
documented, clear, and easily available set of C++ coding standards out there.
For this reason, I don't think it would be a horrible decision to use them for
a new project.

------
d0m
Why a post with only a link to a C++ FQA is that much high rated? Maybe I
missed the point, but everyone with a bit of C++ knowledge already know that
website. Suppose I post a FAQ on python, will it be top 10 ? I don't know, the
author could have added a bit of explanation.

~~~
jacquesm
I figured it is an excellent distillation of what to avoid, and more
importantly, why, written by someone with a lot more knowledge on the subject
than most and in a style that I thought was quite humorous.

That last bit seems to have been received in a 'mixed' fashion judging by the
responses.

