C++ sucks

Martin Naef EMAIL HIDDEN
Thu Nov 22 10:42:30 CET 2007


Hi Peter

Peter Korsten wrote:
> There. I said it. C++ sucks. Big time.

After how many hours of trying something new?

> After three days of swearing at it, I ditched what I'd written and 
> rewrote the C program. My goodness, what was the man thinking when he 
> designed (for want of a better word) C++?

Ahh, here we have it - three days. After you've spent several years 
coding with something else. What the heck do you expect? Becoming an 
expert in a different language after just three days?

> The syntax is impossible to decipher without the Rosetta Stone, it 
> doesn't have interfaces and therefore no clean separation between 
> interface and implementation, you can't return objects except by 
> reference which then keeps dangling (or as a pointer, which is even 
> worse), and in general it's as Spartan as a barracks on the Peloponnese.

Erm, you can return objects (might not always be a good idea, but it 
works), you can nicely separate interface and implementation (either 
through simple or multiple inheritance), and I've yet to find a feature 
that I *really* miss (no, I don't think garbage collection is the answer 
to all your memory issues...).

Of course, Java has been designed years after C++ and hence profits from 
a bit of hindsight - it would be rather sad if it didn't do a few things 
more elegantly.

> It's like you've been driving a nice family car for years, and then one 
> morning you discover that someone has replaced it with a mule and cart. 
> And a very stubborn mule at that.

No, you've replaced the family car with a Ferrari. It's not easy to 
handle, and certainly temperamental, but it doesn't have the extra 
baggage of other systems that holds you back when you have to get down 
to the nitty gritty stuff.

> Really, if you value your sanity, give C++ a wide berth and either use C 
> or Java. C++ is like the unholy offspring of the two.

No. Choose the right tool for the task, and learn it properly.

Bye
Martin

-- 
http://www.navisto.ch
http://www.myspace.com/navisto



More information about the music-bar mailing list