[wx-dev] (64 bit) hashmap/long long problem in HEAD and 2.7.2

Michael Wetherell mike.wetherell at ntlworld.com
Wed Nov 1 13:55:38 PST 2006


On Wednesday 01 Nov 2006 14:25, Vadim Zeitlin wrote:
> On Wed, 1 Nov 2006 14:21:02 +0000 Michael Wetherell
> <mike.wetherell at ntlworld.com> wrote:
>
> MW> >  So I do not think this is a problem.
> MW>
> MW> Yes it is the problem, long is 64-bit on that OS.
>
>  But so what? As I wrote, wxLongLong_t is still a separate type so we
> should allow defining hashes with wxLongLong_t type keys, shouldn't
> we? Even if they're the same as long on this platform, they could be
> different on another one.

I see what's happened now, I didn't notice but you changed the 
definition of wxLongLong on Monday, and I was incorrectly depending on 
the old definition.

> MW> The function longlongHash is an implementation helper for the
> MW> wxLongLong_t overloads of operator(), which should only be
> defined when MW> long is not long long.
>
>  Why? I.e. I though these operator()s had to be defined for all types
> which can be used as hash keys.
>
> MW> > but it is 8 under Windows. So I guess it's
> MW> > better to use wxUint32 explicitly here even though it's still
> wrong MW> > for sizeof(size_t) == 8.
> MW>
> MW> No, it's only used when long is 4 bytes anyhow.
>
>  Supposing we define it when sizeof(long) is 8, of course.

The helper is there because on some 32-bit platforms the standard hash 
doesn't work with 64-bit values. We don't need it when sizeof(long) is 
8. Anyway what you did works, so I'm not rushing to change it.

> MW> >  Anyhow, please let me know if you still have any problems with
> the MW> > revision 1.61 of wx/hashmap.h.
> MW>
> MW> Suggest you revert, why change it when it's been well tested by
> the MW> HashesTestCase though all of 2.6.x?
>
>  It doesn't test wxLongLong_t keys in the hashes though if
> wxLongLongIsLong is defined. Could it be because it doesn't work?
> And, if so, once again, shouldn't it work?

No it's find. Its because it means that wxLongLong_t and long are the 
same type and long is already tested.

Regards,
Mike




More information about the wx-dev mailing list