-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 02 July 2004 16:49, Mark Horton wrote:
I rceived the following warning when compiling the latest php:
Zend/zend_compile.c:71: warning: cast from pointer to integer of different size
From what I recall this can cause undefined behavior. Or can this warning be safely ignored? I looked at the source and it's casting a void* to an int, which I'm guessing is not correct on 64-bit.
You are probably right. If the int is ever cast back to a pointer then that's DEFINETLY a problem. According to gcc, the common data types have these sizes on AMD64: Byte Bit Type Size Size - ----------- ----- ----- char 1 8 short 2 16 int 4 32 void* 8 64 long 8 64 long long 8 64 double 8 64 long double 16 128 time_t 8 64 For code that needs to do pointer <--> integer conversions, a pretty good fix is to replace the int declarations with intptr_t (see /usr/include/inttypes.h). There's also an unsigned variant: uintptr_t. These typedefs are guaranteed to be the same size as a pointer. I've fixed a couple of programs in this way.
Mark
Good luck, - Darrell - -- sused@mucus.com "Perfect! ....what am I doing?" -- Washu -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQFA5lj2eo6c0kw6mZ0RAgsQAKCN+KhNwdnaj9ofS3Y6N/JN/0e3ZgCgkGob SB4dfCrl1wezlpzy2zTd5Ts= =wdJJ -----END PGP SIGNATURE-----