From: yseeley@leland.Stanford.EDU (Yonik Christopher Seeley) Subject: Re: ALPHA-pl11 available on nic: C++ support Date: Fri, 9 Jul 1993 02:54:15 GMT
In article <C9ux90.KpF@murdoch.acc.Virginia.EDU> lfoard@hopper.ACS.Virginia.EDU (Lawrence C. Foard) writes:
>
>I started looking at it once but it just seems far to cludgy.
Could you be more specific? What I myself find a little cludgy about
C++ is some of the syntax in the advanced features. But then again,
readability was never C's strong point either. It is really pretty
good if you take into consideration that it had to stay compatible
with C.
>I went back
>to ANSI C. Its simply a myth that C++ is required for object oriented
>programming.
Agreed, but who are you disagreeing with? Most C++ books acknowledge
this fact. C++ is a hybrid language and doesn't try to be a full
blown object oriented language. Use something like small-talk if
you want something closer to a pure object oriented language.
Also, what did you gain by going back to ANSI C? Since C++ is a
superset of ANSI C, you can have your ANSI C and then mix as little
or as much C++ in that you want. Using C++ doesn't mean that you
*have* to use a totally object oriented design for your project.
>I use object oriented programming all the time in C, the
>only thing C++ would do is eliminate some typing,
Same can be said for any language above assembly. You did say that
you only "had started looking at it once". Maybe it can do more
for you than you first expected.
>but with a cost in run
>time and code size.
Exactly what is larger or slower about the C++ language? If you
start using virtual functions, there will be a slight performance
hit because it involves a level of indirection. This would also
happen if you tried doing the same thing in C via function pointers.
On the other hand, extensive use of class hierarchies can make code that
is larger and slower. This is not because of the C++ class mechanism
(it is very efficient), but because of the overall interaction
between all the classes. Many classes are designed to be very
robust and error free, checking the parameters for errors
before it attempts to operate on them. Now when this class is used
by a class that already did the error checking on it's own, you get
redundant calculation. And when this class.....
The whole thing makes for a more robust system at the cost of some
speed + larger size. The same thing could happen using C, it is
just that classes tend to make people want to implement them
very robustly by providing a good framework. There is nothing
*inherent* in C++ that would make it bigger or slower.
The other problem could be constructors/destructors/type converters
going off where you explicitly tell them to. The cure for this... know
what you are doing, just as you should in any other language.
Just as C gives you ample rope to hang yourself with, so does C++.
The amount of C++ code (from what I understand from the statement
from Linus) is very limited. Things like overloading + stronger
type checking have *no* impact on executable size or speed.
People expecting a totally object oriented language are bound to be
disappointed in C++. Most people who look at it as a better C
have little complaints.
>--
>------ Advantages of being Gay: .
>\ / 1) You can bring your date to the MIT ham swap meet. . .
> \ / 2) You won't be spending eternity with Pat Robertson. . . .
> \/ 3) If you manage to knock up your BF you win the NOBEL prize. . . .
>
- Yonik Seeley
yseeley@cs.stanford.edu