What is C++?

Tom Pittman of www.ittybittycomputers.com wrote a very nice webpage about why he doesn't like C and it's alleged successor. Read about by clicking on the 'IttyBitty' link in the navigator frame.

In short, C++ is:

I have looked into this topic (I cannot call it a programming language) for quite some time now and I come to the conclusion, that C++ is just a minor rewrite of Modula-2, with the keywords of the C language. Yes, C -is- a true programming language, invented by Dennis Ritchie who was a genius of his kind. A genius, on equal terms to Niklaus Wirth.
Anyway, C++ has nothing to do with C at all, apart from the fact that it borrowed the C keywords. I get more and more convinced that the author of C++ (whose initials are BS, and not coincidentally) wanted the sturdyness of Modula-2 in a language that looked like C. And C, being the portable assembler, could not give that by definition.
You see, C was made by a genius, for writing operating systems with. And not for ordinary programmers, writing application software. Now, a true genius like Ritchie can write applications with C. But the problem is, that most C programmers of the day are not elements of the required set: that of the geniuses... Let me state here and now clearly, that I myself neither am nor would like to be a genius, so I have no intentions to use the defacto language for that set.
I know my limitations, so I go for a compiler that helps me and that does not have the power of a portable assembler.

In the remainder of this crusade I will refer to three kinds of people:

  1. The very smart breed of programmers, called 'genius'
  2. The less smart breed of programmers, called 'fool'
  3. The people who don't program, called 'normal'
I already made clear to which part of society I belong.

Who is the compiler?

In C++, you, the programmer, are the compiler, whereas the software with that name is more or less a referee between you and the hardware. You need to remember so many things, exceptions and exceptions on the exceptions.

Specific examples.

  1. C++ is very pleased with its classes and objects, but should it be so? When looking closely at Modula-2, not through the glasses of a Pascal man, but like a C++ user would do, we see that a class is in fact a local module or a separately compiled module. It's nothinh new. It's just another wrapper, intended for geniusses.
    A local module is a separate entity in a program that controls which part is visible by means of IMPORT and EXPORT keywords. These are similar in meaning to the 'private' and 'public' tokens in C++.
  2. In C++, functions can be 'overloaded'. This means, that several functions can get away with just one name. This is confusing, to say the least. Some examples:
      int  CubeMoney (int Volume, int Date, int Wife);
      int  CubeMoney (float Volume, float Date, float Wife);
      int  CubeMoney (float Wife);
         
    All three of these functions may coexist within the same program. How more confusing can it get? From a chaos point of view, this is ideal. But as a structured programmer, this is a nightmare. Evil minded programmers can make 5 identically named functions with different parameter formulations, to obfuscate the source into oblivion.
    This is not a programming language with 'data hiding'. This is pure obfuscation. It is 'structure hiding'.
  3. Overloading in Modula-2 is normal, but it is called otherwise. In C++ you may overload a function with identical names, but different parameter lists. This is dangerous, unless you are a genius. An error is easily made and very hard to track down.
    Modula-2 uses another method to overload functions: by means of qualified imports. You can overload functions from libraries by making a similar function in another module. So if you have two functions called 'Add', but with different parameter lists, you would refer to them in a qualified way, thereby removing every sign of ambiguity. An example:
    IMPORT IntegerMath, Realmath;                    (* qualified import)
    .
    .
    RealMath.Add (FloatVar1, 2.0112);                (* qualified function referal *)
    .                                                (* through the dot operator   *)
    IntegerMath.Add (CardinalVal7, CardinalVal6);
    .
         
    Now, this is my kind of function overloading. It is clear now and to me, but it is also clear to me in ten years and to you now or in ten years. Now that's taking the reuse of code seriously.
  4. For some reason, C++ has an overwhelming amount of obscure tokens. Tokens that can have double meanings, based on the context. Which does not help non-geniuses like me in understanding other people's C++ sources.

    For example: the * and & operators. We all know that the "*" is the prefix of a pointer and the "&" is the prefix for "address of". This is just plain old C and it's not that difficult or unlogical. The tokens are not very well to understand for fools like me, but for a genius, this is a whole other matter. Instead of the "*" I would have preferred a tokenized word, something similar to "POINTER", but then the language wouldn't resemble an assembler anymore.
    C++ offers more than one way to pass arguments into a function, and out of it again. One is by means of pointers, the other is by using a so called reference. The latter is something new compared to C. In fact, it was stolen from Modula-2, where it is symbolized by the keyword VAR in front of a variable in a function declaration. More on this later.
    When referencing a value, you need either the "*" or the "&" operator and placing either is 'free form', although my subset has a lot problems in getting to know how free the form is.

  5. C++ allows me to define a function with n arguments in such a way, that it is still perfectly legal when I supply less parameters in the actual call. An example:
     int  CalcFillRate (int volume, int flowrate = 2, int funneldia = 6);
         
    Now it is allowed to issue a call to this function in the following manner:
     rate = CalcFillRate (5);
         
    In the function prototype I ordered the compiler to fill in the remaining options with default values in case I supplied less than three parameters. But this is highly confusing.
    If you are going to use this 'feature' (I would prefer to call it a parsing bug), you will need to memorize all default values of all functions that use this feature. Swap two default values, and you're in for a big surprise.

    How much extra work is it, to specify the default values in the function call? It will make errortrapping a lot easier.

  6. C++ brags about it's classy inheritance. But what are classes, anyway? What's so special about them?
    The answer is clear: a class is a struct in disguise. The fact that there are two ways of defining a bunch of data, proves my point: C is so complex, that it comes close to chaos.
    Stroustrup probably didn't grab the concept of his classes himself either. That's why things are so overly unlogical. A class is defined in the same way as a structure, but it's functions are defined outside the body of the class. So Stroustrup came up with yet another delimiter: the double colon. This, to make clear to all that the respective function definition is in fact a definition for a function that is part of a class of objects:
      ExClass::ExClass (int x)
      ExClass::~ExClass ()
      ExClass::SetProp (int x, int y, float type=0.0)
         
    The first example is the silly way in which constructors are defined: the classname is copied after the double colon. How few imagination can you have?
    I'll tell you: look at the destructor's name in the second line. A tilde is added to the same silly naming concept, as if the tilde stood for negation in C. Would it have been too far off if the naming convention for a destructor would have been:
       ExClass::!ExClass ()
         
    I guess not, but it fits in well with the rest of C++.
    After another 100 pages in my 21 days book, I have to admit, that the amount of sillyness in C++ is incredible. There is one more further step with classes: the definition of the copy constructor. An example:
       ExClass::ExClass (int x)                 // constructor
       ExClass::ExClass (ExClass (int x))       // copy constructor
         
    C? Three times the same name in a row is the copy constructor. Wouldn't it be much easier if BS would have used a few new keywords? Something like 'CONSTRUCTOR' and 'COPYCONSTRUCTOR'? Or is this too far fetched?

The secret of success.

Now, I see BS more or less like BG, the founder of the company from Redmond (WA) that used to grow big with blue screens of death. It's not very important if a program is good or fast or reliable. It needs to be on the market and it needs to be promoted. And this is the key behind the success of the Redmond company: marketing.
You may not like BG, but you have to admit the guy is a marketing genius. He bought a stolen operating system and sold it as his own, and got away with it. Later he sold a windowing system that was so clumsy that even the Borland TurboVision was better and more flexible. Still, by marketing the thing well, his company grew bigger and bigger.

These guys understand marketing. What do news shows want? They want failure. So the Redmond company will supply failure to them. They let their senior CEO go to a press conference and demonstrate his latest product (let's call it Doors 94) and guess what happens? His demonstrations fails. Now, THAT is news.
All over the world, in prime time news, 5 minutes of airtime is spent on the (preconceived) failure of Doors 94. That's a kind of commercial that wets apetites. It was no wonder that Doors 94 was a smashing hit.

They repeated this same trick for several other releases. In each of these plays, the senior CEO (let's call him Willy Doors) acts as a clown in ruining a demonstration. And each time the world media give him many minutes of airtime at prime time....
Now, who's the fool there.... ?

That is marketing. Period. People will adore Willy for his drive to continue with his demonstrations. It's like with Tommy Cooper, the british 'magician' that blew all his tricks. It was his trademark.

Something similar applies to the success of C++. BS made a lousy language, but he knew just how to hide this from his audience. Instead of finding a new and meaningless name, he had the brilliant marketing idea to call in greed:

I want it bigger, better and faster!

So he started by naming his language after THE language of the time, that was used by geniuses to build operating systems with. But the name would not be just a copy of it. It would be a BIGGER copy. And what is bigger than 'C'?
Easy, one more is bigger than one less. So C++ is bigger and better than C. Every genial programmer can assure you this is the case. Fools may have another opinion, but who wants to be a fool nowadays?
Combine this with the fact that BS stole or borrowed the keywords from the C language as a kind of subset, and C++ is an immediate superset. Now, this is marketing. No logic is required or even appreciated.

From that moment on, people needed to get and learn C++, since it was bigger and better than C, judging the names of the languages. I just wonder what Dennis Ritchie thought of this..
In an interview with Dennis Ritchie he spills some beans:

[Dennis]

C++ benefited enormously from C, because C had a fairly large acceptance even before the growth of C++, and C++ could use C both as a base to build a new language and as a tool to create its compilers. C has been characterized (both admiringly and invidiously) as a portable assembly language, and C++ tries to lift its level to object orientation and a more abstract approach to programming. The faults of both (in recently emerging standards) seem to be excessive ornamentation and accumulation of gadgetry. They both have a certain spirit of pragmatism, of trying to understand what's really needed.

I rest my case.

Page created March 2005,

Page equipped with FroogleBuster technology