On Mon, Jun 2, 2008 at 5:59 AM, Ian Lance Taylor <[EMAIL PROTECTED]> wrote: > Andrew Haley <[EMAIL PROTECTED]> writes: > >> Ian Lance Taylor wrote: >>> Andrew Haley <[EMAIL PROTECTED]> writes: >>> >>>> Richard Guenther wrote: >>>>> On Fri, May 30, 2008 at 10:57 AM, Kai Tietz <[EMAIL PROTECTED]> wrote: >>>>>> Hi, >>>>>> >>>>>> as I noticed, most hash value calculations are trying to use pointer >>>>>> values for building the value and assume that a long/unsigned long scalar >>>>>> is wide enough for a pointer. This is at least for w64 target not true. >>>>>> So >>>>>> I want to know, if it would be good to introduce an gcc specific type for >>>>>> those kind of casts, or to use ssize_t/size_t.? >>>>> it's uintptr_t which should be used, if only as an intermediate cast - >>>>> (unsigned long)(uintptr_t)ptr. >>>> That's not possible because, IIRC, gcc must compile on C90 systems. >>> >>> We can just test for it with autoconf and typedef it if we don't have >>> it. We can figure out what to typedef it to by comparing the sizeof >>> void* to the sizeof the integer types--we already gather these sizes >>> in the configure script anyhow, and use them in hwint.h. >> >> Given that all this seems to be about is avoiding warning messages on >> some extremely unlikely architectures on which gcc may not run, I have >> to question the sens of such heavyweight measures. Why not simply use >> size_t? It would be adequate on every architecture anyone here knows >> about. > > I don't personally find these measures to be heavyweight. I find them > to be fairly routine for the kind of portability we aim for. Only one > person has to get them right once. > > But I'm fine with using size_t also, if it does the right thing on > W64.
If size_t is fine then long is also fine if W64 is compatible with C90 (guess what - it is not). So I'd rather go the full lenghth of using C99 uintptr_t which is what even W64 would be compatible with (C99, that is). Richard.