Welcome, Guest. Please login or register.

Author Topic: Anti C++ sentiment?  (Read 30162 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show all replies
Re: Anti C++ sentiment?
« on: January 26, 2003, 01:18:05 PM »
Quote
DaveP wrote:
Anti-C++-sentiments, why?

I think a quote from Stroustrup himself is in order here: 'C makes it easy to shoot yourself in the foot. C++ makes it harder, but when it does, it blows away your entire leg.' It is indeed easy to abuse C++, or just see the language as a better C. So why would you bother with it then?

I myself don't use C++ for the simple reason that my programs aren't big enough to profit from OO-ness. They would just end up to be same modules, only now embedded in a class architecture. I also have developed a very robust set of input, output, memory handling and error propagation routines, with clear interfaces. You could say I've already programmed in an OO fashion. C++ has a few things going for it (although if you read some of the criticisms on the net, you have to wonder), but I simply haven't felt limited by what C offers me. That said, I think that for many people it's just the fear of tacking on a runtime library to resolve some of the more advanced features. I used to think about performance loss too---now I simply buy a faster CPU  :-P .
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.
 

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show all replies
Re: Anti C++ sentiment?
« Reply #1 on: January 28, 2003, 10:45:09 PM »
Quote
Karlos wrote:
To all the C coders, there's no non-trivial C program that could in no way benefit from some of C++'s features. Even without classes, there's stuff in there that's damn handy, such as function name overloading, declarations as statements, references to name but a few...

I avoid function name overloading like the plague: the implicit argument type promotion rules to test whether two functions are equal are a nightmare. The feature is useful in a few select cases, but in my experience too often led to obfuscation rather than clarity. References... Now there's a feature I'd love to have in C. Although I also believe that every C(++)-programmer should experience the exquisite emotions caused by an oh-so-subtle pointer bug at least once in their lives.

But despite the better features, it has its share of problems too: the syntax is complex (although not unbearably so), it has no garbage collection and still has you managing memory by yourself, and quite a number of others, which may not directly affect a programmer working on his own, but will when working in a team. See this site, for example, although the author gives off the impression of being holier than thou. You can write solid and tidy code with C++; just keep in mind it is not a miracle cure to every programming problem, OO or otherwise.
Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.