lkml.org 
[lkml]   [2002]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: C++ and the kernel
From
Date
>>>>> "Richard" == Richard B Johnson <root@chaos.analogic.com> writes:

Richard> On Tue, 9 Apr 2002, Dr. David Alan Gilbert wrote:
>> * Richard B. Johnson (root@chaos.analogic.com) wrote:
>> I would like to rewrite the kernel in FORTRAN because this was
>> one of the first languages I learned. Seriously, the
>> kernel MUST be written in a procedural language. It is the
>> mechanism by which something is accomplished that defines an
>> operating system kernel. C++ is an object-oriented
>> language, in fact the opposite of a procedural language. It
>> is not suitable. Bollox! There are many places in the
>> kernel that are actually very OO - look at filesystems for
>> example. The super_operations sturcture is in effect a virtual
>> function table.

Richard> The file operations structure(s) are structures. They are
Richard> not object- oriented in any way, and they are certainly
Richard> not virtual.

The term "virtual" has a very specific in OO, esp. in C++.
Unfortunately, this word isn't a very faithful description of what it
means. Java uses the keyword "abstract" for what is "virtual" in C++.
This is much more appropriate.

And "virtual function table", "vptr", "vtable" are also specific terms
in OO which refer to implementation details of the run-time of an OO
language. To you, this shouldn't be anything new. A "virtual
function table" is just an array of pointers to functions. It serves
essentially the same purpose as the super_operations structure in the
Linux kernel. Instead of having to building the table (in source
code, not run-time) yourself, the compiler of C++ and any OO language
would do it for you automatically, thereby saving typing effort and
avoiding trivial typos.



--
Sau Dan LEE 李守敦(Big5) ~{@nJX6X~}(HZ)

E-mail: danlee@informatik.uni-freiburg.de
Home page: http://www.informatik.uni-freiburg.de/~danlee

-
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 13:25    [W:0.301 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site