Re: linux headers and C++

Marco Ermini (mail@markoer.org)
Tue, 6 Jul 1999 21:25:50 +0100


----- Original Message -----
From: Khimenko Victor <khim@sch57.msk.ru>
To: <mail@markoer.org>; <alan@lxorguk.ukuu.org.uk>
Cc: <linux-kernel@vger.rutgers.edu>
Sent: Tuesday, July 06, 1999 6:39 PM
Subject: Re: linux headers and C++

> I not think. I know :-) Latest versions of cfront had (has? is cfront
still
> alive?) had all such bells and whistles acting as preprocessor...
[snip]
> > All things that you can't do in C. If
> > you'll read Stroupstroup you'll agree
> > with me.
>
> Hmm. Cfront was developed under Stroustroup lead, don't it ?

When cfront was in the run, template,
for istance, simply didn't exists. And C++
was the half of what is know. I think you
have to update your C++ knowledge, too...

> Then what's your definition of *true* OO ?

If you're asking for a rigourous definition,
it's much better asking to Stroustroup or
Meyer, not me :-P

> > Maybe I could explain what I mean
> > for a true OO OS: you define a class
> > for a "serial communication device", you
> > define a "serial port", you inherit a "modem"
> > from both of these and a little more code.
>
> Why you think that multiple inheritance is so important for "true" OO ?
[snip]
> Yet again: multiple inheritance. Ugly code bloat in 99% cases.
> WHAT code can be inherited from abstract "Modem" ?
[snip]
> Not at all. Usually multiple inheritance add a lot of complexity without
> real gain. USB is not realized not due problems with Linux design but
simple
> since there are was not enough motivated and skillfull hackers :-))
> And no you do not need "USB soundcard". You just need clearly separated
> abstractions. So just one soundcard driver will be used for ISA, PCI,
PCMCIA
> and USB soundcards with the same chipset...

This example was just a paradox. As you
could see if you read the mail until the end,
just a paradox to intend that all the teorethical
approach to an OO OS are overrun by the
simple and efficient approach given from Linux.
This what I meant in my previous mail,
what I mean now, and what I'll always think ;-)

I have no plans to automagically produce
USB drivers from anywhere...

> > Of course, and that's what I meant
> > originally, this could be a very fashinating
> > approach, but I think it's much more
> > theroethical that really doable.
>
> More important: it's much more sophisticated then really need !

I agree.

> You can do multiple inheritance with C if you really need. But in most
cases
> it's just not needed. Simple and clean source text of C++ usually lead to
wrong
> assumptation of simple and clean compiled code. Unfortunatelly this is not
> a case: A LOT OF simple and elegant C++ constructs lead to ugly code.

OK.

> Multiple inheritance is one of them. On other hand ugly things (like
multiple
> inheritance :-) lead to ugly C code and that is usually enough to
understood
> that something is wrong with design...

This depend on the compiler. As
Stroustroup said, there are many
people thinking that they don't have
to use C++ because it produces
more complex and long assembly
code. But *he*'s C++ compiler (what is it,
we don't know) produces shorter code
than the C ones. It really depends on the
compiler. If you take g++ as your
milestone, this could be your
conclusion, but I can't take your
assumption for granted in any
case on any compiler. On Visual
C++ (which is a very good
compiler, unfortunately it produces
Windows programs), I could
examine the asm code and I
don't see all the bloating code
you say.

Cheers

Marco

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/