Firstly, this is not a hoax:
Is it possible to include int to remove the pointer and back to int?
The difference in questions is this: I use void * to store int, but I never use it as void *.
So, the question really comes down to the following:
Is void * guaranteed to be at least as wide as int
I cannot use intptr_t because I am using c89 / ANSI C.
EDIT
In stdint.h from C99 (gcc version) I see the following:
#if __WORDSIZE == 64 # ifndef __intptr_t_defined typedef long int intptr_t; # define __intptr_t_defined # endif typedef unsigned long int uintptr_t; #else # ifndef __intptr_t_defined typedef int intptr_t; # define __intptr_t_defined # endif typedef unsigned int uintptr_t; #endif
Can I possibly just install something like this and expect it to work? It would seem that casting should work like all intptr_t is a typedef for an integral type ...
Robert S. Barnes
source share