[lkml]   [2000]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux kernel modules development in C++
Timur Tabi wrote:
> ** Reply to message from Alan Cox <> on Wed, 27 Sep
> 2000 22:00:54 +0100 (BST)
> > > I have written the Windows platform version in C++ using Numega's tools
> > > encapsulating the driver code in classes.
> > > More of this classes isn't OS specific and it work well in any OS.
> >
> > And do you rely on any exception throwing ?
> >
> > If you use no exceptions (including thus using new and other constructors that
> > allocate) you should be ok.
> I don't think any OS supports exception handling in a driver. It wouldn't make
> much sense, since there's no way for a driver to really "exit" (which is the
> ultimate destination of the exception).

Ah, no, the ultimate destination of the exception is an exception
handler. Thowing exceptions in drivers would be a wonderful thing to be
able to do, then maybe I wouldn't have to do a hard reset every time my
developmental filesystem oopes during mount. Throwing exceptions has to
be coupled with code that can remember resource allocations and clean
them up along the path of the exception. You have to have some support
in the task management too: if you want your throw to be efficient you
pretty well have to remember the trapping context in a static per-thread
location. It's doable, I know, I've done it and the result tends to be
really nice to look at and easy to understand. The code is usually
smaller and more efficient too because it isn't littered with a lot of
conditionals that just watch for errors and pass them back to the
caller. You can use a cleaner function interface in many cases,
eliminating parameters here and there.

That said, do not expect to see exception handling in Linux any time
soon - the existing mechanisms may not be elegant but they work.
Anybody who wants exceptions in the kernel will have to overcome a *lot*
of skepticism and there is exactly one way to do that: by showing code
that works and is better.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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