On Tue, Jul 07, 2009 at 04:45:51PM +0100, David Chisnall wrote: > Collisions don't matter with -hash, they are expected. The > requirement is that if [a isEqual: b] then [a hash] == [b hash]. > There is no requirement that unrelated objects may not have the same > hash.
Okay, that turns the whole truncation thing into a non-issue. > > Unfortunately, GNUstep has not yet made the switch to the Mac OS > > 10.5-style definition of NSUInteger, which would just make this a > > non-issue because it would always be sized properly. > > It did a while ago, perhaps you are using an old version. That said, > NS[U]integer is equivalent to C99's [u]intptr_t, and since we require > C99 you can use these instead. I've just checked, and -hash is > declared as returning an NSUInteger on GNUstep. The definitions are in place, they are just not used at the moment. The relevant portion of Foundation/NSObjCRuntime.h in GNUstep trunk looks like this: > #define GS_64BIT_OLD 1 // Temporarily disable new OSX 10.5 64bit API > > > #if defined(GS_64BIT_OLD) > > typedef int NSInteger; > typedef unsigned int NSUInteger; > typedef float CGFloat; > > #else /* GS_64BIT_OLD */ > > typedef intptr_t NSInteger; > typedef uintptr_t NSUInteger; > #if GS_SIZEOF_VOIDP == 8 > #define CGFLOAT_IS_DBL 1 > typedef double CGFloat; > #else > typedef float CGFloat; > #endif > > #endif /* GS_64BIT_OLD */ > The correct fix for this is just to change the return type of -hash in > ETReflection.m to match the GNUstep version. As you can see from the above NSUInteger won't silence the compiler warning, but uintptr_t will. For the sake of consistency, one could still leave the return-type as NSUInteger but still cast the pointer to uintptr_t. Cheers, Niels _______________________________________________ Etoile-dev mailing list Etoile-dev@gna.org https://mail.gna.org/listinfo/etoile-dev