Re: C++ pushback

From: Xavier Bestel
Date: Tue Apr 25 2006 - 05:22:35 EST


On Tue, 2006-04-25 at 11:13, Avi Kivity wrote:
> Martin Mares wrote:
> >>> Calling a C function is simple and explicit -- a quick glance over
> >>> the code is enough to tell what gets called.
> >>>
> >>>
> >> No, you need to check all the functions it calls as well.
> >>
> >
> > Yes, but if it calls none (or calls basic functions I already know),
> > it's immediately visible without having to circumnavigate the globe
> > to find declarations of all sub-objects :)
> >
> >
> Yes, but if the constructor constructs no sub objects (or basic objects
> you already know) then it's immediately visible as well.

Yes, "if". With straight C, it's immediatly obvious the kmalloc() is the
only function with side-effects and special requirements - an
experienced hacker won't even look it up. With C++ those may be hidden
behind each object or object member, that's the philosophy of the
language.
The problem is that in kernel mode you must know precisely when and how
you allocate memory.

Xav


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/