[comp.lang.c++] C++ - ADVANTAGES/DISADVANTAGES, FIELDS OF APPLICATION

bause@exunido.uucp (Falko Bause) (01/26/89)

C++ - ADVANTAGES/DISADVANTAGES, FIELDS OF APPLICATION


I'm preparing for a short speech on the C++-language.
Although I'll know the main features of C++, I do not
have daily practical experience.
Now I'm trying to list up all advantages/disadvantages
of C++. I think you have daily practical experiences
with C++ and know what features you are missing or why
you prefer C++.
So please send me a short note.

Furthermore I'm looking for main fields of application
of C++. So if you are using C++ in your project tell
what you are doing and what do you think about future
fields of application of C++.


Please answer by e-mail. If there is enough interest
I'll summarize to the net.

Falko

bause@exunido.uucp (Falko Bause) (02/13/89)

C++ - ADVANTAGES/DISADVANTAGES, FIELDS OF APPLICATION

I've posted this question to the net a few weeks ago, but
unfortunately I've only got 2 answers and a lot of mails
that wanted me to summarize the answers to the net.
So I try a second and last time....


I'm trying to list up all advantages/disadvantages
of C++. I think you have daily practical experiences
with C++ and know what features you are missing or why
you prefer C++.
So please send me a short note.

Furthermore I'm looking for main fields of application
of C++. So if you are using C++ in your project tell
what you are doing and what do you think about future
fields of application of C++.


Please answer by e-mail, I'll summarize to the net.

Falko

bause@exunido.uucp (Falko Bause) (03/21/89)

Here is the summary of advantages/disadvantages and main fields of
application of the C++-language.
Because there were only a few responses, i list excerpts of the original
answers. If you have questions please contact the given address.
- Falko -


From Doug Schmidt <schmidt%siam.ics.uci.edu%PARIS.ICS.UCI.EDU@uunet.uucp>:
==========================================================================


1. Main DISadvantages:

   a. NO STANDARD REFERENCE MANUAL!!!!!!

   b. No support for exception handling, parameterized types or tasking
      (this is a result from the AT&T's attempt to stay close to the
       C and UNIX heritage).

   c. Language cannot be described by an LALR(1) grammar (makes it more
      difficult to write a correct compiler).

   d. Certain recent features of the language are rather difficult to understand,
      i.e. pointers to function members, multiple inheritance, etc.
   
2. Main Advantages

   a. Combines the flexibility of assemble language with the power and
      abstraction of higher level languages.

   b. Easy to learn if you know C.  

   c. Very nice support for abstract data types (IMHO better than Ada
      and Modula 2.

   d. Supports inheritance and object oriented features not found in most other
      procedural languages.
   e. Reasonably good compiler available for free (GNU g++).

   f. Language is growing and evolving, so that missing features today
      may be found in future releases.

   g. Much better type checking than C.


From Michael Tiemann <tiemann%lurch.stanford.edu@uunet.uucp>:
=============================================================

Disadvantages:

No concept of modules.  For truly large programs, it is impossible for
one programmer to hide his private names (such as class names) from
another programmer.  This causes name conflicts, which the compiler
may or may not detect until a system is installed.

Ambiguous syntax.  The grammar of C++ is inherently ambiguous.  As a
result, parsing C++ is essentially impossible, though one can write
parsers which closely approximate what Bjarne had in mind when he
created the language.  For example, the following C declaration:

        TYPE (*EXPR)();

could be interpreted as either, declaring EXPR to be a pointer to
function returning type TYPE, or it could be to take EXPR, dereference
it (or apply operator *), cast the resulting expression to type TYPE,
then use the result as a function to call (or to apply operator ()()).
As you can see, there are two perfectly valid interpretations of the
same syntactic form.  The reason for declaring variables in
programming languages was to avoid the problems that could crop up in
languages like fortran:

C       initialize i
        ii = 0

C       use i
        f (i)

as you can see, there is a typo (ii instead of i), but since ii is
implicitly declared, no error message is generated.  How can a C++
compiler know whether it should be declaring a new variable, or using
an old one in the case above?

C++ uses a references, which are not very complicated to understand,
but they are not taught in standard programming courses.  As a result,
as you can see, there is a typo (ii instead of i), but since ii is
implicitly declared, no error message is generated.  How can a C++
compiler know whether it should be declaring a new variable, or using
an old one in the case above?

C++ uses a references, which are not very complicated to understand,
but they are not taught in standard programming courses.  As a result,
it usually takes the average programmer about 6 months to figure out
on their own when and how to use references.

C++ provides a rich variety of features, but syntactic limitations
keep these features from being usable in a lot of contexts.  As a
result, C++ features are more ad hoc than orthogonal.  For example, it
is possible to have an object, and object which needs a constructor
(for initialization), and an object which needs a constructor which
takes arguments.  It is also possible to declare an array of objects,
an array of objects which take constructors, but not an array of
objects which need constructors that take arguments.

The method for initializing static class members, and the whole issue
of initialization of file-level objects exposes just how weak the unix
compilation environment (using ld) actually is.  This is not a fault
of C++ per se, but C++ really stretches its environment at its weakest
points.

Objects are not objects.  This means that the language offers no
special support to those who wish to write their own object oriented
environments.  See Keith Gorlen's OOPS package to see how complex such
a task is without any help from the language.

Stroustrup added features to C++ to make it possible to write code
without using as many macros.  However, some of these features (such
as the notion of a class) came without additional support (like the
way to get a class's name as a string), so more uses of macros were
needed.  Again, Gorlen's OOPS package makes extensive use of macros.
The best example of this is that C++ does not provide a `super' method
(which would return a classes base type), so the very declarations of
classes in OOPS must be done with macros.


From Ben Verwer <ben%duttnph@mcvax.uucp>:
=========================================

For one person, a few thousand lines of code, C++ has as advantages:
it is easier to read, better to comprehend, though you in the beginning
quite often overlook a remark in Stroustrup's book.
It's main disadvantage is that it is much slower, since you
know more than the compiler. E.g. each object is referenced by a
pointer. For small objects, used in small loops, it is a few factors
slower to reference the objects' data via the pointer, rather than
putting the data in a register. E.g. list_iterators, queues.
Once my code works, I often translate my C++-code piecewise back to
regular C. It makes the difference between a smashing performance or one
during which you start to think about the coming coffee-break.
(I am working on a thesis on robot path finding).


From Dr. James Coggins <coggins%unc%mcnc.org@uunet.uucp>:
=========================================================

Application: research in computer vision/computer graphics

Advantages: I work with a large library of procedures. C++
provides structure to the name space of those procedures,
making management and use of the library easier.  C++ helps
to isolate architecture from implementation - a desirable
differentiation.

Disadvantages: There is a cost in the complexity of the
preparations required to make a C++ library operate properly.
C++ appears much more complex if you do not fully adopt O-O
design.  if you do, many of the features fall into place and make
sense.


From Rob French <rfrench%ATHENA.MIT.EDU%bloom-beacon%garp%ames%mimsy@uunet.uucp>:
=================================================================================

I've been using C++ for some time now.  My primary applications have
used the InterViews toolkit as a very easy to use alternative to the X
toolkit.  I'm in the process of doing my bachelor's thesis on
heuristic optimization techniques for silicon compilers.  I'm using
C++ to write my compiler since it can easily handle dynamic objects,
and my project is more orientation toward an object-oriented
programming approach.

levy@fine.Princeton.EDU (Silvio Levy) (03/22/89)

In article <1216@laura.UUCP> bause@exunido.UUCP (Falko Bause) writes:
> From Michael Tiemann <tiemann%lurch.stanford.edu@uunet.uucp>:
> =============================================================
> 
> Disadvantages:
> ...
> C++ uses a references, which are not very complicated to understand,
> but they are not taught in standard programming courses.  As a result,
> it usually takes the average programmer about 6 months to figure out
> on their own when and how to use references.

With all due respect to Michael, this is a gross exaggeration.  For one
thing, references are explained (though poorly) in Stroustrup.  For another,
after programming in C for a while one is *highly* motivated to find
alternatives to pointer passing, etc.  So at least in my case the
time it took to figure out references was more like a couple of days,
which is a far cry from 6 months (unless you count the time I
programmed in C before and wished C had something like references).

Silvio Levy