[Gluster-devel] 32/64 bits portability

Emmanuel Dreyfus manu at netbsd.org
Mon Aug 11 03:58:55 UTC 2014


Hi

I note this kind of warnings:

meta-helpers.c:42:13: warning: cast to pointer from integer of different
size
meta-helpers.c: In function 'meta_fd_release':

This is caused by the attempt to use uint64_t as a placeholder for
pointers. That causes warnings on machines with 32 bit pointers, and of
course you are doomed the day pointers get bigger than 64 bits (not for
tomorrow, but we all know computers do not need more than 640 kB,
right?)

uintptr_t is the right type to use in such a situation. POSIX defines it
as an unsigned integer capable of holding a pointer. <stdint.h> takes
care of defining it to the right size:
http://pubs.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html

Fixing this warning in meta-helpers.c means modifying libglusterfs
interfaces and cause a widespread change, hence I will not submit it,
but I just share that information in case some courageous developer want
to give it a try for the sake of portability.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu at netbsd.org


More information about the Gluster-devel mailing list