[MUD-Dev] Languages

Shawn Halpenny malachai at iname.com
Fri May 23 13:08:16 CEST 1997


Caliban Tiresias Darklock wrote:
> 
> On Thu, 22 May 1997 19:23:19 PST8PDT, Ben Greear
> <greear at pollux.cs.uga.edu> wrote:

> >I'm curious about some things.  What exactly makes c++ slower?  Is it
> >more class calls because most ppl make accessing class data a function
> >call?  Perhaps inheritance mapping of some sort?  I head that a c++
> >compiler basically just translates the code into c before compile anyway..
> 
> The problem I see in projects built using proper OOP in C++ is that the
> same data is validated over... and over... and over... and over...
> because none of the objects can make any assumptions about the others,
> so they can't ever take for granted that someone else has validated the
> data. If they did, they'd break the whole reuse thing.

That reflects poor design in the reuseable components, IMO--or at least
in the documentation of them.  I'm a proponent of the "validate as close
to the input source as possible" school of design, and if the interfaces
are properly documented in those objects close to the source, there
should be no reason for data to be validated ad infinitum.

As for C++ being slower, there is a bit of extra overhead depending what
you are doing with it.  For example, non-inlined member function calls
will each carry an extra parameter (the 'this' pointer) into the
function.  Use of virtual functions often requires an extra layer of
pointer indirection in order to map to the desired member function.  The
list can go on...none of the features necessarily making C++ worse than
any other language, nor particularly any better.  I like it, though, and
will use it because it will let me accomplish what I want with less
effort than in other languages I've looked at.

Also, I think the number of modern C++ compilers that translate code
into C is between few and none (though it used to be common practice). 

--
Shawn Halpenny



More information about the mud-dev-archive mailing list