lkml.org 
[lkml]   [1999]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: C++ in kernel (was Re: exception in a device driver)
In <m0zz5Kt-0007U2C@the-village.bc.nu> Alan Cox (alan@lxorguk.ukuu.org.uk) wrote:
>> The rest is FUD: it's trivial to "figure out" when you are passing a
>> "self" pointer argument around: only non-static member functions have
>> them.

> On the contrary


> foo1.C

> blah->foofunc();


> foo2.C

> blahobject::foofunc()
> {
> printf("Hi");
> }

> a C++ compiler ends up passing "this" needlessly because it can't tell that
> foofunc of object blahobject need not know who it is.

> Thats only one example.

Bad example. If foofunc is declared static then "this" will not be passed.
If in the future static will be removed (since new version of foofunc will
use part of blahobject internals) then WITHOUT changes in foo1.C (but with
recompilation, of course) "this" will be passed !




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

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.065 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site