lkml.org 
[lkml]   [2000]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Linux kernel modules development in C++
On Wed, Sep 27, 2000 at 04:14:39PM -0500, Timur Tabi wrote:
>
> 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).
>
> By the way, new and delete are NOT exceptions. They are simply
> wrappers for malloc() and free(). Just define your own malloc and free
> (they can be wrappers for a kernel memory allocation API, or you can
> write your own heap manager), and new and delete work just fine.

new and delete used to be just constructor/destructor-calling wrappers,
before exception handling went into the language. Now new is supposed
to throw a bad_alloc exception instead of returning NULL. If you have
an operator new like this:

void *operator new(size_t) { return NULL; }

then g++ will complain about it even with '-fno-exceptions'. You can use
new and delete in code without exception handling, I'm just explaining
why people would expect it to be an issue.

Periodically someone posts a minimal C++ runtime to LKML. A much larger
problem than the runtime is the fact that C++ is not the language of
choice of other kernel developers, making them reluctant to deal with
(and hence, to incorporate) your driver.

miket

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

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