Re: C++ in kernel (was Re: exception in a device driver)

Chip Salzenberg (chip@perlsupport.com)
Fri, 15 Jan 1999 23:08:42 -0500


According to Khimenko Victor:
> Even two constructs like
> A. someclass var(1);
> B. someclass var=1;
> are NOT equal!

Yes, and ... ? Initialization and assignment are entirely different
animals in C++. Anyone who doesn't know that isn't ready to _read_
C++ code, much less write it.

> Somebody:
> > However, C++ has some language features that let you specify optimal code
> > constructs that would otherwise have to be hard-coded in C. The fact is that
> > you don't need to know any more than you would with C and some times less.
>
> You'll need to know HUNDREDS of C++ quicks instead ...

Exaggeration. Tsk.

> If you'll use objects you are tied to VERY LIMITED C++ object model.

That's a feature, not a bug. C++'s object model is limited to
features that have efficient implementation and which penalize only
those who use them.

> In C++ could not change nature of your class in run-time -- it's
> hardcoded in compile-time.

You are mistaken. Standard C++ features allow just such
transmogrification. I should know -- it's a key part of the
implementation of (what might become) Perl 6. Example:

Base *target = new Derived1;
// begin transmogrification
void *p = dynamic_cast<void *>(target);
target->~Base();
target = new (p) Derived2;
// end transmogrification

Tadaa, all done. Only requirement is that the new class be no larger
than the old one -- same as C. :-)

> C++ is just big non-shapen heap of different things, not clear
> language like Ada or even Java. Some concepts there are usefull,
> some not. But it's total mess as whole.

C++ is a tool, not a sculpture. Read "The Design and Evolution of C++"
if you don't like this. Stroustrup is eloquent and, I believe, right.

-- 
Chip Salzenberg      - a.k.a. -      <chip@perlsupport.com>
      "When do you work?"   "Whenever I'm not busy."

- 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/