On Mon, Jun 04, 2007 at 08:54:03PM +0200, Ion GaztaƱaga wrote:
I'm a bit puzzled, because it seems odd that the hook is not aligned to 4 bytes even if you have a char between data and the hook. The compiler might be reordering things a bit.
No, the data stored in the pointer-to-member is *not* the "real" offset, contrary to your assumption :) When checking in the debugger, the hook is aligned properly.
Could you check the real distance between klass and hook_? Something like:
The statement (after adding 'klass k' in the local scope of main())
cout << (char*)&k.hook_ - (char*)&k << endl;
prints out 84.
Furthermore, given the following program:
==
#include