Hi Mathias, first of all: Thanks for your patches! Unfortunately, this one is not correct for 32bit systems. The reason is that NSInteger is pointer sized, so itβs a 32bit quantity on 32bit platforms. On 32bit OS X/iOS, calling -scanInteger: with a string representing a larger value (say β9223372036854775807β, aka LLONG_MAX), will give you the maximum value an integer can hold, while your solution will just do some implementation defined thing when casting the 64bit value to 32bits. (I think most of the time, you just loose the higher bits, so for β9223372036854775807", you might get -1 instead of 2147483647, which would the correct result given the Apple implementation).
Cheers, Niels Am 16.01.2014 um 15:52 schrieb Mathias Bauer <[email protected]>: > Hi, > > I discovered that NSScanner misses some "scan..." methods. At least in one > case it should be trivial to add it: > >> - (BOOL) scanInteger: (NSInteger *)value >> { >> long long result; >> BOOL ret = [self scanLongLong:&result]; >> if (value && ret) >> *value = (NSInteger)result; >> return ret; >> } > > Would it be possible to add this as a patch? > > Regards, > Mathias > > _______________________________________________ > Discuss-gnustep mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/discuss-gnustep _______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
