[TUHS] C++ / Kernel

Steffen Nurpmeso steffen at sdaoden.eu
Sat Aug 25 02:59:38 AEST 2018


Derek Fawcus wrote in <20180824132244.GA2979 at accordion.employees.org>:
 |On Thu, Aug 23, 2018 at 10:42:40AM -0400, ron at ronnatalie.com wrote:
 |> 
 |>> Has anyone experimented with building Unix using C++, to take
 |>> advantage of strong typing?  My guess is no--it would be a Herculean \
 |>> task
 |> likely to introduce more bugs than it would fix.
 |
 |I recall that there was an attempt to do this with the Linux kernel,
 |but that it was abandoned before it was completed, this would have
 |been pre '98. Probably pre 2.4 Kernel.
 |
 |I have vague memories of discussions about it on the (kernel) mailing
 |list at the time, and that it was the original cause of the 'asmlinkage'
 |annotation on the C level syscalls - basically to turn off C++ name
 |mangling for when the assembler syscall table referenced the C routines.

Also the often seen C paradigm of using "enum bla" in prototypes
results in C++ compilation warnings/errors if the enum is actually
used to define flags rather than a true enumeration, and there are
not "bit enumerations" which would accomplish that.  So you need
to use an integer for the prototype and have lost all checking
capabilities with a glance.  I have never understood this
deficiency.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



More information about the TUHS mailing list