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

H. Peter Anvin
2024-01-12T02:25:11Z

On 1/9/24 15:40, David Howells wrote:
>
>> Both C and C++ has had a lot of development since 1999, and C++ has in fact,
>> in my personal opinion, finally "grown up" to be a better C for the kind of
>> embedded programming that an OS kernel epitomizes.
>
> And gcc got rewritten in C++ some time back, so they have a vested interest.
>

Indeed.

>>> (8) 'virtual'. Don't want virtual base classes, though virtual function
>>> tables might make operations tables more efficient.
>>
>> Operations tables *are* virtual classes. virtual base classes make sense in a
>> lot of cases, and we de facto use them already.
>
> You end up adding storage for a 'this' pointer for each virtual base class, I
> think - and then you may have extra fun if you inherit from two classes that
> both inherit the same virtual base class. Abstract base classes that are just
> ops tables are probably fine, though.

My apologies, I meant *abstract* base classes, not *virtual*. To be
honest, I don't think I have ever used virtual base classes in any other
application than games (relating to physical objects), and barely even then.

-hpa