Hello everyone,
For the following code, on x86 build, the output is
000000C8
000000C8
and on x64 build, the output is
CCCCCCCC000000C8
00000000000000C8
I think the reason is, for x64, both void* and void** are 64bit, for for x86
void* and void** are 32 bit, and for int, always 32bit for both x86 and x64.
This line of code "void* b2 = *b1", dereference b1 and makes it into 64-bit
on x64, which concatenate value of a 0x000000C8 and previous DWORD
0xcccccccc, so forms the result 0xCCCCCCCC000000C8.
But on x86, when dereference b1 and makes it into 32-bit on x86, and
recovers to original value 0x000000C8.
In my understanding correct?
[Code]
#include <iostream>
using namespace std;
int main()
{
int a = 200;
void** b1 = (void**)&a;
void* b2 = *b1;
int b3 = (int)*b1;
cout << (void*)b2 << endl;
cout << (void*)b3 << endl;
return 0;
}
[/Code]
thanks in advance,
George