This is the mail archive of the
mailing list for the GCC project.
Re: Question about building hash values from pointers
Kai Tietz wrote:
> Andrew Haley <email@example.com> wrote on 30.05.2008 11:45:50:
>> Kai Tietz wrote:
>>> as I noticed, most hash value calculations are trying to use pointer
>>> values for building the value and assume that a long/unsigned long
>>> 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
>>> those kind of casts, or to use ssize_t/size_t.?
>> Why would it matter? Are there any circumstances is which not using the
>> upper part of an address will reduce performance or break something?
> First of all it matters about warnings. The native build of w64 gcc is
> full of 'cast from pointer to integer of different size. The second, IMHO
> the more important reason, is that a general type to express a host
> pointer scalar size would prevent such bugs as in PR/36386.
If what Andrew Pinski says is true, this is not a bug at all. Not
that I'm against fixing warnings, of course; using long where size_t is
meant is probably a hangover from the days when gcc had to compile on
You can't use ssize_t, though, as it's nonstandard.