I guess a 64bit processor does need 64bit addresses to reference memory. But
at the same time, if 32 bit programs are to run unmodified on 64 bit
architectures there needs to be ways in which 32bit pointers can still work.
So, I am almost 100% sure that compiling 32bit code, even on a 64bit
processor, should yield 4 for sizeof(void*)
You are 100% right. Tried this on 2 laptops:
printf("Is this a %s-bit machine?\n", ((sizeof(void*) == 4) ? "32" : "64"));
32-Bit ubuntu (10.10) on 64-bit proc:
"Is this a 32-bit machine?"
64-Bit ubuntu (10.10) on 64-bit proc:
"Is this a 64-bit machine?"
Regards,
-mandeep