Re: Compiling C++ modules

Avi Kivity
2006-05-02T15:04:27Z

Al Viro wrote:
> On Tue, May 02, 2006 at 05:02:55PM +0300, Avi Kivity wrote:
>
>> Hey, I agree 100%, except for the last 6 words :) C++ is the very worst
>> language I know in terms of badly thought out features, internal
>> inconsistencies, ways to shoot one's feet off, and general ugliness. It
>> will require _very_ tight control to avoid parts of the kernel going off
>> in mutually incompatible directions.
>>
>> But I think that the control is there; and if C++ is introduced slowly,
>> one feature at a time, it can be kept sane. And I think there is
>> definitely a payoff to be won out of a switch.
>>
>
> You are far too optimistic. In the best case it'll end up with higher
> artificial entry barrier for contributors. In the worst (and much more
> realistic) the crap will leak all over the tree in addition to the
> already present classes of bugs.
>
> "Everyone has his pet subset/extension" is a killer for anything that isn't
> done by 5-6 people, or, at least reviewed by 5-6 people who really can
> read through _all_ incoming code. For something like Linux kernel...
> forget it. It's far outside of the area where that would work.
>
If it has 'template' or 'operator' in it, make sure some sane people
look at it.

IIRC, when the gcc people discussed this, they raised the possibility of
adding compiler switches to allow subsetting the language. But there's
nothing real out there that I know of.

BTW, C++ could take over some of sparse's function:

int foo(user_ptr<struct fugly_ioctl_arg> arg)
{
return bar(arg->field); // won't compile
struct fugly_ioctl_arg s;
if (arg->copy_from_user(&s))
return -EFAULT;
return bar(&s); // yes!
}

--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.