From 4759468580452529968
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,fbd36da46c3cc7a0
X-Google-Attributes: gidf78e5,public
From: "AllanW" <AllanW@my-deja.com>
Subject: Re: Discussion: type_info
Date: 1999/12/07
Message-ID: <82ju8c$jbf$1@oak.prod.itd.earthlink.net>#1/1
X-Deja-AN: 557886718
Distribution: Snookums: I love you
X-NNTP-Posting-Host: 205.231.129.50
Approved: stephen.clamage@sun.com (comp.std.c++)
References: <81ecdl$pq$1@nnrp1.deja.com><memo.19991126195718.59965A@btinternet.com> <81u646$kln$1@nnrp1.deja.com><823n5t$7qg@library1.airnews.net> <384BBE4F.ABDC393C@lucent.com> <7QYbIRArmTT4Ew2J@robinton.demon.co.uk>
X-UID: 0000000001
X-Priority: 3
X-Status: $$$T
X-Mimeole: Produced By Microsoft MimeOLE V5.00.2615.200
X-ELN-Date: 7 Dec 1999 21:29:48 GMT
Organization: Snookums: I love you
X-MSMail-Priority: Normal
Newsgroups: comp.std.c++
Originator: clamage@taumet


> In article <384BBE4F.ABDC393C@lucent.com>, Michiel Salters
> <salters@lucent.com> writes
> >What do you mean, being unable to hash pointers?

Francis Glassborow <francis@robinton.demon.co.uk> wrote in message
news:7QYbIRArmTT4Ew2J@robinton.demon.co.uk...
> Well there is a small problem, many distinct bit patterns can represent
> the same pointer (consider the way pointers work in segmented
> architectures) so the relationship between pointers and addresses is
> many:one.  How do you propose to provide your unique hash?

AFAIK, any system that has a many-to-one relationship between pointers
and addresses also has some concept that I'll call "normalization" which
is already used when comparing two pointers for equality. This is by
definition platform-dependant, so we can't give out algorithms, but we
can give an example:

    Change the bit pattern so that when it is interpreted as a pointer, the
    address does not change, but when it is interpreted as an integer, the
    value is lower. Continue until this change is no longer possible, and
    then the bit pattern represents the normalized value.

Naturally, for any real platform there will be equivalent algorithms that
do not involve iteration.



[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




