RE: [PATCH 00/45] C++: Convert the kernel to C++

From: David Laight
Date: Thu Jan 11 2024 - 16:38:12 EST


> Can we get memory safety with C++ now? and also stop people coding C++
> like it's 1994?

What is the run-time cost?
Things like 'smart pointers' are dumb!
CSTRING is an abomination.

I suspect you need to pass array_pointer:length pairs about in
order to get reasonably array bound checking.
So splitting C's pointer-array equivalence.

But you then need to efficiently return them from functions.
That really needs a register pair be used.
Typically two registers are reserved for function returns,
but are only ever used for double-sized integers.
Doing that without compiler support would be hard work.

The other elephant in the room is compilation speed.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)