Re: C++ pushback

Xavier Bestel
2006-04-25T09:22:44Z

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