Zeljko Vrba wrote:
On Mon, Jun 04, 2007 at 05:10:31PM +0200, Ion Gaztañaga wrote:
Since I don't have access to a SunCC compiler you will need to help me discover how SunCC implements pointer to data members. I will need for
It's downloadable for free, both for Linux and Solaris :)
I've just started downloading Solaris Express for Developers, but it's taking a while ;-)
The program at the bottom prints the following for NN=10 and NN=20:
4 45 4 85
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. Could you check the real distance between klass and hook_? Something like: int main(void) { using std::cout; using std::endl; klass k; cout << ((char*)k.hook_ - (char*)k)sizeof(ptr) << endl; return 0; } If the distance is exactly 45 and 85 then you can try to add sunCC detection in the first part of the parent from member function and see if everything goes well. If the real distance is something different, we'll need to try something new. Thanks for the help, Ion