Messages in this thread |  | | Date | Wed, 27 Sep 2000 15:42:32 -0700 | From | Mike Touloumtzis <> | Subject | Re: 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/
|  |