lkml.org 
[lkml]   [2004]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: What if?
From
Date
On Thu, 2004-12-02 at 08:33 +0000, J.A. Magallon wrote:
[...]
> Constructor/destuctor is needed, and also virtual single inheritance.
> And those two things are already being done by hand with function
> pointers inside structs in the kernel. The cost of (single and multiple)
> inheritance in C++ is also just an indexed jump, the difference is that
> in the pseudo object oriented things done in the kernel you have to

If software is object-oriented is a question of design, not the
implementation language. So it is neither necessary nor sufficient to
use a (so called) "object-oriented language" to get (or not get)
OO-software.

> always initializa the funtions pointers, and C++ will do it for you.
> How many bugs have you seen because somebody wrote a bad
> .method = the wrong_func in an initializer ?

You like putting the "read" function into the place of the "open"
function in a struct file_operations?
If you name your functions meaningful, you probably see it at the time
you write the code.
And if you do not see it during coding, you probably will see it on the
very first test run.
So the effect is at most moving initialization code and logic from a
the .c in a .h file?!

The unanswered question is: What does it actually buy?

Exceptions, STL, and most of the fancy features are not usable and must
be thrown out (you even have to forbid them and look after it).
The holds - more or less - for operator overloading (except in very few
cases).
So the usual C++-(and OO-) marketing propaganda does not help since most
features (including all standard run-time libs) are either not usable or
forbidden.
Yes, you get probably stricter type checking - most of this is in C also
doable.

Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services

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

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.093 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site