Deutsch English Français Italiano |
<865xv3ic14.fsf@linuxsc.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch <tr.17687@z991.linuxsc.com> Newsgroups: comp.lang.c Subject: Re: Good hash for pointers Date: Fri, 24 May 2024 06:18:15 -0700 Organization: A noiseless patient Spider Lines: 51 Message-ID: <865xv3ic14.fsf@linuxsc.com> References: <v2n88p$1nlcc$1@dont-email.me> <86v834i1o9.fsf@linuxsc.com> <v2okbv$1vp4n$2@dont-email.me> <86r0dshysc.fsf@linuxsc.com> <v2omvt$2049k$1@dont-email.me> <86ed9shtsj.fsf@linuxsc.com> <v2ppac$29ca1$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Date: Fri, 24 May 2024 15:18:17 +0200 (CEST) Injection-Info: dont-email.me; posting-host="4e2ccf3374e48a9f13e87ba250cb95a8"; logging-data="2470156"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+UkbMu0iV6i6RRO7H79SaDH9A00+OaqNs=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:tW/7sS+ae1hIs5iLQEMAOPMbrts= sha1:BArnzI+hMtg8dcFvmoPmKyzPDTc= Bytes: 2834 bart <bc@freeuk.com> writes: > On 24/05/2024 02:39, Tim Rentsch wrote: > >> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes: >> >>> On 24/05/2024 00:52, Tim Rentsch wrote: >>> >>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes: >>>> >>>>> On 23/05/2024 23:49, Tim Rentsch wrote: >>>>> >>>>>> Malcolm McLean <malcolm.arthur.mclean@gmail.com> writes: >>>>>> >>>>>>> What is a good hash function for pointers to use in portable >>>>>>> ANSI C? >>>>>> >>>>>> I have a preliminary question. Do you really mean ANSI C, or >>>>>> is C99 acceptable? >>>>> >>>>> C89 is better. >>>>> But the pass has been sold. >>>> >>>> I'm not asking which you think is better. I'm asking about >>>> what your requirements are. >>> >>> C 89. >>> I don't want to pull in C99 types and so on just for a hash >>> function. >> >> In that case I think you are stuck with using a half-baked >> solution. The standard integer types available in C89 just >> aren't a good fit in a 64-bit world. > > I assume the C89 implementation is one that can target current 64 > bit machines. > > Then char, short, int, long long will almost certainly have widths > of 8, 16, 32 and 64 bits respectively. C89 doesn't have long long. > (I don't know if 'long long' was part of C89, but it sounds like > Malcolm just doesn't want to be bothered with stdint.h, and any > compiler used is like to support it. What he said was C89. He didn't mention stdint.h. I take him at his word. If what he wants is something different, he should say clearly what it is, and not make people guess about it. (To be clear this recommendation is intended for every questioner, not just Malcolm.)