Hi!

On Fri, Dec 28, 2007 at 06:36:42PM +0100, Marc Espie wrote:
>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.

IIRC in Effective C++ there's good stuff about being safe with
exceptions too.

>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).

qt is GPL without L in front, which makes it difficult to use from a
licensing perspective in quite some settings.

>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.

*nods* It's difficult, indeed, but one *can* write stuff, for many
application areas. BTDT. (Using OpenBSD as development platform, btw.)

>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++).

Not slow in my experience. Used to be, perhaps. Not any more. On
OpenBSD, btw, using JDK 1.5 or 1.6, and Eclipse as development
environment. Good experience because of *fast* turnaround times and a
somewhat leaner language.

Yes, I had the same prejudices against Java for a long time. And there
will be areas where I still will prefer other languages like C or C++,
or sometimes scripting languages or functional languages over Java,
when/because they're a better fit.

>- 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.

When I tried, python felt slower than perl, even.

>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.

Agree.

Kind regards,

Hannah.

Reply via email to