lkml.org 
[lkml]   [1999]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: C++ in kernel (was Re: exception in a device driver)
    A non-optimizing compiler is likely to pass that extra pointer and would be
    correct in doing so. However, the only reason to ever declare a method as a
    non-static member of a class is when the method needs to access data for that
    classes specific instance. Its no surprise that the compiler would pass the
    extra compiler and, in fact, as a user of that class, you would assume that the
    compiler would be doing just that from a quick glance of the interface. I
    thought the issue was that you couldn't always tell when "this" was passed or
    not. This is not true. Furthermore, I cannot think of an example that makes any
    sense where your example would occur.

    regards,

    Ben Scherrey

    Alan Cox wrote:

    > < prelude to example snipped >
    > 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.


    -
    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:4.406 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site