public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Clark <michael@metaparadigm.com>
To: root@chaos.analogic.com
Cc: Zan Lynx <zlynx@acm.org>, Bart Samwel <bart@samwel.tk>,
	Ashish sddf <buff_boulder@yahoo.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Compiling C++ kernel module + Makefile
Date: Wed, 21 Jan 2004 10:24:26 +0800	[thread overview]
Message-ID: <400DE2DA.8060001@metaparadigm.com> (raw)
In-Reply-To: <Pine.LNX.4.53.0401201306030.12044@chaos>

On 01/21/04 02:10, Richard B. Johnson wrote:
> 
> Well you just fell into the usual trap of using the "C-like"
> capabilities of C++ to call a 'C' function. If you are going
> to use 'C' library functions, you don't use an object-oriented
> language to call them. That is using a hatchet like a hammer.
> 
> I did not malign C++. I used it as it was designed and let
> the chips fall where they may.

Apple has succedded in using C++ in their kernel. Its IOKit uses
an embedded subset of C++ (no exceptions, RTTI, non-trivial
descructors, etc) as part of their device driver framework.

The features they keep; polymorhism, inheritance, encapsulation
provide for a very clean and easily extensible framework.

Writing IOKit drivers is much cleaner than using plain C
without out all the structures with pointers to functions
(explicit implementation of virtual functions and a lot of
casting of (void*) and/or unions).

http://developer.apple.com/documentation/DeviceDrivers/Conceptual/IOKitFundamentals/About/chapter_1_section_1.html

Although this could all be done in C (as is all the OO stuff in
linux like VFS, block and chardevs, etc), it is certainly much
cleaner in C++.

Although horses for courses, we all know C++ won't fly in
the linux kernel. Just I think 'embedded C++' which is an
actual specification and a genuine superset of C and subset
of C++ retaining safre features for kernels can't be ruled
on on technical merits but rather only on personal opinion
of language choice. Personally i prefer Linux's more explicit
OO implmentation with the use of stuctures with pointers to
functions (virtual functions) although not sure there is a
really clean pattern used for inheritance (unions and void*
private pointers) and encapsulation (static function bounday).

~mc


  parent reply	other threads:[~2004-01-21  2:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 21:09 Compiling C++ kernel module + Makefile Ashish sddf
2004-01-16 22:07 ` Richard B. Johnson
2004-01-17 12:59   ` Bart Samwel
2004-01-19 13:46     ` Richard B. Johnson
2004-01-19 17:40       ` Bart Samwel
2004-01-19 18:39         ` Richard B. Johnson
2004-01-19 20:02           ` Bart Samwel
2004-01-19 20:37             ` Richard B. Johnson
2004-01-19 21:24               ` Bart Samwel
2004-01-20 15:20                 ` Richard B. Johnson
2004-01-20 17:34                   ` Zan Lynx
2004-01-20 18:10                     ` Richard B. Johnson
2004-01-20 13:38                       ` Thomas Lahoda
2004-01-21  2:24                       ` Michael Clark [this message]
2004-01-20 18:16                     ` Chris Friesen
2004-01-21 17:01                 ` Giuliano Pochini
2004-01-21 17:16                   ` Bart Samwel
2004-01-20  0:59               ` Robin Rosenberg
2004-01-20  6:46                 ` Linus Torvalds
2004-01-20  7:32                   ` Robin Rosenberg
2004-01-20 10:46                   ` Bart Samwel
2004-01-20  5:29         ` Valdis.Kletnieks
2004-01-20  9:48           ` Bart Samwel
2004-01-16 22:40 ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2004-01-19 13:21 Petr Vandrovec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=400DE2DA.8060001@metaparadigm.com \
    --to=michael@metaparadigm.com \
    --cc=bart@samwel.tk \
    --cc=buff_boulder@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    --cc=zlynx@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox