On Fri, Dec 28, 2007 at 07:37:54AM -0600, Marco Peereboom wrote:
> Wow one comprehensive list of the suckage that is C++.  Thanks Miod now
> I dont need to type examples anymore.

I will probably regret this, but all of these issues are known, and only
show that C++ is not a simple language.

Real C++ programmers know how to work around these. C++ is all about
giving you choices.

As a list:
- No compile time encapsulation: deliberate language choice. You want to
provide clean C++ interfaces ? you use the `compiler firewall/pimpl' idiom.
As a good example, look at the KDE libraries.  It's all about NOT having to
pay the extra price if you want speed to the detriment of portability.
- complicated grammar: red herring. This does NOT account for any amount of
slowness of C++ compilers. It *does* account for somewhat bad error messages.
It is complicated to build a yacc parser for C++, and thus to add meaningful
error messages.  Every slow C++ compiler out there is slow for other reasons.
Mostly, that you need efficient data structures to take care of namespace
lookup (C doesn't have that issue: it doesn't have any support for namespaces).
And also, that people abuse inline functions.  As far as different compilers
interpreting rules differently, C++ was not standardized until 1998...
Did you try any new-fangled C99 constructs recently ? Like, variable
definitions work everywhere on every C compiler shipped with OpenBSD ? Yeah,
right...
- No easy way to locate definition: mix of stuff inherited from C (where you
can do anything with include files, and thus you're relying on people having
bad habits) and OO practice, where it is indeed often difficult to locate
definitions... That's why smalltalk has browsers...
- No run-time encapsulation. Yeah right... as if there are no smart pointers
out there. Not worse than C.
- No binary implementation rules... partly false. There are ELF ABIs for C++,
fortunately, and Unix implementations follow them these days. That's a bit
like looking at C from 20 years ago. Between COFF, a.out, and other shit,
you did not have a binary implementation either...

Rules for types and operators are fairly complex, granted, but there is
some actual logic. This is well documented in a few books. The main issue
with C++ there is that it it a big language. You want to understand those
rules ? You have to read Scott Meyers.

Exceptions can be managed. Again you have to read Herb Sutter.

And yeah, the standard library is somewhat small.  But there are useful
libraries out there developed on top of C++, and they work (qt is the
one nice example, as far as I'm concerned).

All of this shows the one thing we already know, which is that C++ is
a terribly complicated language that is hard to master. When it's used
properly, by people who know how to program in it, it can be really good
and really fast. I'm still happily using quite a few apps written in C++,
like most of kde, and I don't see them getting rewritten in anything else
yet.

You want OO ? you've got a choice of:
- C++, which *works*.
- java, which is really slow, and not portable at all (and written partly
in C++).
- smalltalk, which is beautiful, very nice, and that no-one uses because it
does not talk to the rest of the world, still locked in its ivory tower.
- eiffel or ada... yeah right, everyone uses them.
- python or perl, which work just fine... perl has about the same set of
defects as C++ (except for speed and reflection). python is probably about
the same, I don't use it enough to comment.

In the end, I still see C++ as a valid choice for *seasoned* programmers.
It is very, very hard to use, and thus I would never recommend it to a
beginner.

Reply via email to