[GD-General] Re: meaning of sizeof(int) on all plateform
Brought to you by:
vexxed72
From: Enno R. <en...@de...> - 2003-06-28 22:49:02
|
Jay Woodward wrote: > Hold on -- it seems to me that the existence of forward declaration necessitates that all pointers be the same size. > > I suppose you wouldn't lose information when casting, as long as it's guaranteed that sizeof(void*) >= sizeof(any other pointer). Still, my understanding has always been that all pointers are the same size. Life would be so nice if we had some guarantees like that. The only thing that I know you have a guarantee for is that void* and char* are compatible, and it's necessary that pointers to structs can be cast between each other. However, on several architectures function pointers will be of a different size than data pointers. On a Cray, if I remember this correctly, both void* and char* are 64 bits, but all other pointers are only represented using 32 bits. And you can choose to have ints represented with only 46 instead of the full 64 bits! Enno. -- <xterm> The problem with America is stupidity. I'm not saying there should be a capital punishment for stupidity, but why don't we just take the safety labels off of everything and let the problem solve itself? |