Hacker News new | past | comments | ask | show | jobs | submit login

>> The pointer to instance part is the `this` pointer.

> What do you mean? The this pointer isn’t computed until you try to call the pointer-to-member-function.

Think of it from a compiler writer's perspective.

The implicit parameter when using a pointer-to-member function is the function pointer itself. The `this` (instance) pointer must be passed explicitly when invoking it (along with whatever other parameters the function requires).

Ergo:

>> The pointer to instance part is the `this` pointer.




Pointer to what, exactly? It doesn't make sense for it to be an object instance pointer, because you can use the same pointer to member on several different objects instances. If one instance's pointer was embedded in the pointer-to-member, it wouldn't work for other instances.

I have no idea what the format of a pointer-to-member is. It sure looks like a small closure.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: