This page hosted by
Get your own Free Home Page
C++ Language Features.
The Common Wisdom about C++
Supporters and critics usually agree that C++ has three major flaws:
-
It wasn't created from the
ground up:
|
The operator ++
(pronounced plus-plus) in the name C++ means that this language
is an increment over C. C++ was first thought of as C with classes,
then later an enhanced C. Dr. Stroustrup,
the creator of C++ once wrote that he wanted C++ to be as close to C
as possible, but no closer. |
|
It is usually considered that the obligation
of being that much compatible with C didn't let Dr. Stroustrup design a
clean language. This explains why C++ is not as elegant and purely object-oriented
as languages like Eiffel,
or Smalltalk.
These languages were designed from a clean slate. |
|
Dr. Stroustrup denies this. |
-
It is a complex language:
|
Newcomers to C++ can be awed by the puzzles
that even some innocent language constructs can define. An advanced C++
magazine called
C++ Report
prints a monthly column called
Obfuscated C++
where bewildering language entanglements are shown. Sometimes it is
sadly funny to see how a much errors a poor C++ programmer can
inadvertently create in his or her work.
|
-
It is a huge language
|
The size of a language is defined by the number
of its reserved symbols: words, operators etc. By this measure C++ is a
huge language. That means it is more difficult to create compilers for
C++ than it is for other languages. And that the compilers offer less confidence. |
|
As we all know a compilers is a form of software
like any a word processor, a spreadsheet, etc. There's not still a way
to fully demonstrate a software correction, particularly in these days
of complex software and operating systems. One can only test a limited
sample of all possible conditions for a software. |
|
So a complex software is much more prone to
errors than a simple one. Thus, potentially a C++ program has a greater
chance of being compiled incorrectly than does a program written in a
simpler language. Even supposing that a program was compiled correctly,
a complex language is also more likely to induce the programmer into
error. That is, the greater number of choices one is faced with
correspondlingly increases the odds of writing a buggy program.
|
There are no easy responses to these criticisms.
However, from a programmer point of view, C++ has some
advantages.
-
It is fast:
|
It is common sense that C programs are
efficiently translated to a processor's machine language, since C
structure reflects the conceptual structure of a typical processor.
|
|
Since the C++ programming language is so
close to C, it is valid to expect the same thing for C++ programs;
|
-
It is portable:
|
When the first implementation of C++ was done
(see cfront below), the compilation
generated C code. Wise guys from Bell Labs. |
|
As C had compilers for virtually every
processor, that allowed C++ to spread all over C world. Every computer
that had a C compiler could have a C++ compiler. Instant portability!
|
|
Since Borland 3.1, C++ compilers yield
straight machine code. And the situation nowadays is the opposite:
with very few exceptions, there are no more C compilers available, for
all C compilers are actually C++ compilers, that have C as a kind of
subset. |
-
It is powerful:
|
C++ has lots of useful features: from
low-level pointers to multiple inheritance, everything is there. |
|
This is why
Dr. Stroustrup says that C++
allows multiparadigmatic programming. That means a programmer
can use it to implement a structured design, without even thinking of
OOP; or use it to
implement orthodox object-oriented
designs;
|
-
It is comfortable:
|
Since C++ has lots of features, to program in
it is very comfortable. Usually we don't have to contort the the language
to do what we want: there's a feature just waiting for us somewhere. All
a programmer has to do is use the feature. |
|
That is not a synomym for bad programming practices.
A program with a bad design is a bad program in any language. That only
means a programmer doesn't need to automatically be enforced to the same
view of programming as the language's designer. |
-
It is compatible with the C
programming language:
|
It is never useless to repeat that C++ is compatible
with C. That means there are lots of softwares written in C that can be
easily adapted to run in C++. |
|
For instance, operating systems: several operating
systems are written in C. That means most of their features are instantly
available to C++ programmers. They don't have to wait till someone creates
a binding for their language. |
-
It is faster.
|
This is just a provocation that will bring the
language wars to these pages, but any C++ programmer can only be pleased
to see how fast his or her programs run. |
|
As someone said, other languages are fast
ways to create slow programs. |
C++ Language Definition, Critique and Puzzles
C++ Critique
C++
Critique, by Ian
Joyner.
C++ Standard Draft
C++ Language Standard
Draft, in HTML format.
Obfuscated C++
At http://www.qds.com/ob_c.htm,
also known as Obfuscated C++ Archives, there was a repository of
problems with C++ syntax and semantics.
Up to the moment, no longer available.
Back to page Free C++ Help.
Back to page
Panorama of C++ and Related Topics.
Back to main page.
Thank you for visiting my pages.
These pages are under permanent construction.
Acknowledgements:
You can reach me by e-mail at: HFernandes@GeoCities.Com
These pages were accessed
times since 1998/10/05.
Last altered: 1998/10/05 21:22:06