Re: C++ in kernel

Benjamin Scherrey (scherrey@gte.net)
Tue, 12 Jan 1999 02:31:19 -0500


Michael Elizabeth Chastain wrote:

> Yo, Mr. Scherrey. Don't tell us -- show us. Grab a tarball, build
> it with your choice of C++ compiler, find some place where C++
> solves a problem, and come back with a demo.
>
> It doesn't have to be a ready-to-integrate polished patch. It just
> has to show people that it solves some problem somehow.

Actually over the last couple of days in my "spare" time I've been getting
kernel code to build under C++ yet still be buildable under C with identical
output. Not exactly fast going but hasn't been too difficult thus far. My hope
is that we can get C++/C buildable code patches integrated as part of the
development of kernel 2.3. At this point it will be possible to start
introducing C++ keywords and facilities into parts of the kernel code. Already
I've uncovered some questionable auto-casts by the compiler (for instance an
unsigned int param being passed a signed long - fine if sizeof(unsigned int)
>= sizeof(long) and 0 < val(long) <= maxval(unsigned int), no guarantees
here). Other issues that would eventually be addressed are like the impact of
changing uid's (and other exportable data) types could be more easily
localized for example. These are the "short term" benefits of such an effort.

Primarily, I want to get linux into a position to be able to continue its
feature growth and flexibility that it's demonstrated thus far. I'm concerned
that code rot will eventually set in at the rate things are currently going.
However, I feel that the nature of Linux' development requires that some pre
acceptance of support for C++ compilation by current maintainers be achieved
before following through completely with the effort. Reason being - as soon as
C++ keywords get intermixed in the code, its no longer a C system that could
be compiled by gcc. G++ would have to be the compiler of choice for that code
and, inevitably, the rest of the kernel. I have no desire to "branch the
tree". I do feel that Linux must evolve or be displaced, however, and that
this eventuality will arrive in the next decade.

regards,

Ben Scherrey

-
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/