Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 05 Mar 2002 17:10:23 -0800
From:      Terry Lambert <tlambert2@mindspring.com>
To:        "Brian T.Schellenberger" <bts@babbleon.org>
Cc:        Kenneth Culver <culverk@alpha.yumyumyum.org>, "Steve B." <steveb99@earthlink.net>, "Eugene L. Vorokov" <vel@bugz.infotecs.ru>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: C vs C++
Message-ID:  <3C856C7F.5005E30E@mindspring.com>
References:  <20020305132457.A4700-100000@alpha.yumyumyum.org> <3C8529DA.FA8ABCE@mindspring.com> <20020305214127.545FDBA03@i8k.babbleon.org>

next in thread | previous in thread | raw e-mail | index | archive | help
"Brian T.Schellenberger" wrote:
> On Tuesday 05 March 2002 03:26 pm, Terry Lambert wrote:
> > Kenneth Culver wrote:
> > > Why are you being so sarcastic? Everyone here is assuming that it's
> > > harder to write C++ code, so you should only use it if necessary. It
> > > isn't necessary to use it for something like a daemon.
> >
> > Because that underlying assumption is false, and I'm making
> > fun of it.
> 
> Reality check:  How can you possibly contend that it is no more difficult to
> write code in a language which *so* much more massive?

It's not "*so* much more massive".  Hardly anyone who wants
to write understandable code uses operator overloading, unless
the are definiing a "String" or "ImaginaryNumber" class, and
then it's incredibly clear-cut what's going on.

The "private" vs. "public" is incredibly useful for data
hiding, as well as namespace seperation.  It means you
can't spam values accidently, if you can't spam them on
purpose.

If you have a hard time with "default private", then use
"struct" instead of "class" for declaring things, and the
default will be "public" instead.

The "protected" and "friend" features are seldom used; if
you understand FORTRAN mutual recursion as a means of
implementing recursion in FORTRAN, which doesn't support
it by default, then you understand "friend" functions.

Inheritance is logical, to anyone who has ever programmed
in the FreeBSD networking stack or VM system, both of which
use structure casts to implement inheritance, whether you
want it or not.

Multiple inheritance is like "protected"... for the most
part, you can ignore it.


> And one, I might add, which is intentionally UNdesigned.

Yeah, and ANSI-C has prototypes because the compiler vendors
were too damn lazy to change their object format to include
a third field in the symbol table so that the problems that
prototypes catch at compile time could be caught at link-time.

The hidden reason for ANSI-C prototypes, of course, is, and
always has been, "so that C code could be compiled with a C++
compiler, with the intent that the C++ language supercede the
C language".

So now, I expect you to vehemently protect the existance of
ANSI-C prototypes at every future opportunity.

C++ was designed, but the design was constrained by the C
language, just as the design of ANSI-C was constrained by
the C language.


> C++ is a language which I really liked until I really started
> to learn about it.

Well, there's a "ringing" condemnation.

Have you looked at the source code for libXt or libXm
lately?  Ah, the beauty of pure C code, applied to the
Object Oriented programming model...

Object oriented programming is not some mystery, it's a means
of solving problems that are best modeled by abstracting
implementation details complexity into objects, so that you
can concentrate on writing the code, and not on the details
of the implementation.

It's also a way of enhancing code reusability, through the
use of design patterns.  Once you've written one binary
search, you've written them all.

If you understand functional decomposition, then you
unsertand the most fundamental tenet of object oriented
programming already.


Can we all move on to something more useful, like criticizing
Java?

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C856C7F.5005E30E>