Messages in this thread | | | Date | Sun, 10 Jan 1999 22:05:18 -0500 | From | Benjamin Scherrey <> | Subject | Re: 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/
| |