Re: linux headers and C++

Dancer (dancer@zeor.simegen.com)
Wed, 07 Jul 1999 12:32:10 +1000


Alan Cox wrote:
>
> > new should throw bad_alloc if it fails to allocate memory. If you catch
> > and rethrow exceptions properly you can do all the standard releasing of
>
> That needs exceptions. You will have a fairly bad time trying to handle
> C++ exceptions in the Linux kernel (apart from the giant table size g++
> outputs you have to deal with interrupts, re-entrant exception handling and
> the like - and of course you have to handle running out of memory in the
> exception handler (yes this last one is foul in C too))

egcs doesn't generate thread-safe exceptions, despite what the doctors
say. At least not a recent (one month old?) version I got from the egcs
project page. There actually appear to be all sorts of thread-safety
problems. In a simple app, I experienced heap and stack corruption
(often happening deep in the bowels of the first pthread_create call).
Dubious, am I, young Skywalker. Highly dubious.

>
> > The primary reason I can see to keep C++ out of the kernel is that the user
> > base doesn't seem to be large enough to get over the initial barrier of
> > making it work and supporting it yet. If it were, the necessary patches
> > would already be in doubters hands and none of us would be wasting
> > bandwidth on the subject.
>
> Writing mainstream kernel code in C++ would IMHO be crazy. Allowing people
> to write C++ modules seems to be quite reasonable.

Agreed and agreed, IMO...and I think that this is largely what this is
about. At least before the witch-burners and the demon-worshippers all
turned up at the same cab-rank.

D

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