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:
In the remainder of this crusade I will refer to three kinds of people:
Who is the compiler?
In C++,
Specific 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.
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.
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.
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.
How much extra work is it, to specify the default values in the function call? It will make errortrapping a lot easier.
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?
ExClass::!ExClass ()
I guess not, but it fits in well with the rest of C++.
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:
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:
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