-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hrvoje Niksic wrote: > Micah Cowan <[email protected]> writes: > >> Hrvoje Niksic wrote: >>> Micah Cowan <[email protected]> writes: >>> >>>> Hm... well, what about a check for C99 first, and then a fallback on >>>> checking for HAVE_STDINT_H? >>> Isn't HAVE_STDINT_H a C99 thing? C89 doesn't seem to mention it. >> I thought HAVE_STDINT_H is more a configure-script thing... > > Sorry, I meant stdint.h, the header file. > > The code was careful to test for stdint.h and if not found, it would > assume that pointers fit into unsigned long. It still seems like a > reasonable assumption (lacking proper uintptr_t, at least), and I > don't understand how exactly it failed on Interix. To fail, the > system would need to both not support stdint.h in any form, and have > Win64-style pointers larger than longs. Possible, but not very > likely.
If it didn't support stdint.h, obviously this patch would not have worked. The point is that the code _doesn't_ check for stdint; it checks for C99. >> There's the other possibility, of trying to avoid casting a pointer >> to an integer type in the first place. I haven't looked much at this >> code, though, and honestly probably won't any time real soon. > > The code casts pointer to integer in two places: the first is to > implement an "invalid pointer" constant, and the second to hash a > pointer value by identity. I'm not sure if you can eliminate > uintptr_t from those places without essentially reinventing it. Where do we need to hash pointers, instead of string values? What about iterating over the pointer value with a (char *) for sizeof (pointer-type) bytes, to generate an appropriate hash (IOW, treat it the same way strings are). Obviously this is (mildly) slower than using an int value directly. - -- Micah J. Cowan Programmer, musician, typesetting enthusiast, gamer. Maintainer of GNU Wget and GNU Teseq http://micah.cowan.name/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAknyhMgACgkQ7M8hyUobTrFfBQCgjdo9y/y4ytMDMtOKELqEyMDp vJMAn2kpTzF9IbsySZZyuZYLYtZrpUy0 =CHQp -----END PGP SIGNATURE-----
