thanx & later,
Ben Scherrey
Khimenko Victor wrote:
> In <003101be3db0$d4d945e0$04c809c0@Fake.Domain.com> Anthony Barbachan (barbacha@Hinako.AMBusiness.com) wrote:
>
> AB> 1 - It does not lead to speed loss.
>
> It does. Take a look:
> -- C++ code --
> #include <iostream>
>
> class someclass {
> int i;
> public:
> explicit someclass(int _i) : i(_i) {}
> virtual foo() {
> std::cout << i << endl;
> }
> };
>
> void test(someclass& x) {
> x.foo();
> }
>
> void main (void) {
> someclass a(1);
> test(a);
> }
> -- C code --
> #include <stdio.h>
>
> struct someclass {
> int i;
> int (*foo)(struct someclass*);
> };
>
> int someclass_deffoo(struct someclass* x) {
> printf("%d\n",x->i);
> }
>
> /*
> * int someclass_otherfoo(struct someclass* x) {
> * printf("%d\n",x->i<<1);
> * }
> */
>
> void test(struct someclass* x) {
> x->foo(x);
> }
>
> int main (void) {
> struct someclass a={1,someclass_deffoo};
> test(&a);
> /*
> * a.foo=someclass_otherfoo;
> * test(&a);
> */
> return 0;
> }
> -- cut --
-
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/