Re: NSString to Integer
Re: NSString to Integer
- Subject: Re: NSString to Integer
- From: Jonathan Hess <email@hidden>
- Date: Sat, 7 Mar 2009 20:37:10 -0800
When using a 64-bit architecture, Mac OS X uses 32 bit integers, but
64 bit longs. NSInteger is defined as a long for 64, not an integer.
When running 64-bit, you need to use %ld as the format option.
Try this and see if it works any beter:
NSInteger d = [@"43253234929732" integerValue];
NSLog(@"%qi, %ld", (long)d, (long)(d%2));
Good Luck -
Jon Hess
On Mar 7, 2009, at 5:41 PM, Sean McBride wrote:
Dave DeLong (email@hidden) on 2009-03-07 7:55 PM said:
I'm on a 2GHz Macbook Unibody, so I'm expecting that d is a 64-bit
integer.
Don't expect, measure. What does sizeof(d) give?
Also, if you want a 64 bit integer, use int64_t. NSInteger changes
size
depending, as others have said.
Sean
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden