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

Khimenko Victor (khim@sch57.msk.ru)
Sun, 17 Jan 1999 00:05:15 +0300 (MSK)


In <19990116154225.N4232@perlsupport.com> Chip Salzenberg (chip@perlsupport.com) wrote:
CS> According to Khimenko Victor:
>> struct BaseVptr {
>> int (*foo)(struct Base* this);
>> void (*destructor)(struct Base* this);
>> };

CS> Adding the destructor doesn't make your test valid if you don't bother
CS> to call it. And you didn't.

When I'm refer to "change nature of object" I'm refer to "change nature of
object": data is not changed while behaviour of object is changed. Since
I'm not know how to do this in C++ (may be some other low-level hack will
help :-) but in your example there are created new object at the same address
as old object. Not exactly what I'm want but close. But in C++
constructor/destructor calls should be paired (god knows what destructor call
will do EXCEPT of [here empty] body -- think about debug realization with
external database of created objects :-) and destructor should be virtual is
we'll call it via pointer to base class, not via pointer to derived class
while in C we could not bother itself with such things: it's always clear
where which function will be called and when. And we are shure that compiler
will not add any magic !

CS> This is my last reply to you, Victor; I find you closed to reasoning.

No problem with me as well. If you not want to see truth -- it's your problem.
You made WRONG claim about VERY simple construction. You said that non-portable
low-level hack is 100% ANSI C++ compatible. And since admitting your mistake
is way beyound your imagination you just stopped relationship with me :-))

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