Rhea Myers

C Plus Plus Is Teh Suxx0r

const I** const **don’t const like const C++ const. constI use Lisp or JavaScript for my own work. I also use C, scheme and PHP occasionally. I have taught C and Java, and hacked Java and C++ professionally for years at a time. I have also done a lot of BASIC, Dylan, Objective-C, AppleScript and Python at one time or another.I can honestly say that C++ is the worst programming language I have ever used. Worse than Python, worse than AppleScript. There are a number of reasons for this:

  • The standard libraries require complex, irregular code to use and have many gotchas. Smalltalk, Java and the scripting languages are better.
  • The best thing you can say about the strings is that they are not as bad as Lisp strings. Even C strings are better.
  • The class and function system is complex and encumbers the user with premature design decisions. Java or Objective-C are better. Lisp’s CLOS is heaven.
  • With C code, you know what will be created by any given code construct. C++ makes this random, polluting the namespace and codespace with random nonsense that may or may not include defaults.
  • C++ streams are a bit sucky. Using overloaded bitwise operators is funny for the first two minutes, but is a pain for the next few decades.
  • C++ is often sold as a systems programming language but it mangles exported symbols and has no shared library system. So it isn’t any good as a systems programming language.
  • Idiots claim that C++ is fast. It is not fast unless you discard vtable dispatch, exceptions, RTTI, and new/delete. In other words C++ is fast if you use C instead.
  • C++ re-uses keywords like const in unpredictable and silly ways.
  • Const correctness is about as useful as Hungarian Notation.
  • If you have ever declared something to be a friend, you have discovered why C++’s encapsulation is not as good as CLOS. Or C.
  • The new coercion operators add complexity without making things any safer. You just have an extra four bad choices you can make.
  • No garbage collection but don’t worry, no good memory management either.
  • References. Just everything about them.
  • A static typing system that will stop you doing only useful things.
  • The STL being value based. If you don’t understand why that is bad then congratulations, you are one of the original authors! So basically, use C if you want the good bits of C++, or a dynamic or functional programming language otherwise.Don’t believe me? Here’s Linus answering a C++ booster:http://thread.gmane.org/gmane.comp.version-control.git/57643/focus=57918

Technorati Tags: hacking