On Sat, Mar 7, 2009 at 9:37 PM, Jonathan Hess jh...@apple.com wrote:
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.
( bit width with 32b
Am I missing something?
NSInteger d = [@43253234929732 integerValue];
NSLog(@%qi, %d, d, (d%2));
2009-03-07 17:36:32.620 TestApp[37000:10b] 6442450943, -1073743928
I'm expecting it to output 43253234929732, 0...
I'm on a 2GHz Macbook Unibody, so I'm expecting that d is a
I don't know what the default compile settings are for 64-bit machines,
so I could be wrong. However, I think the default is 32-bit only,
regardless of environment. You have to set the compiler to also compile
64-bit binaries in the Info window of the project (right click on your
project name
On Sat, Mar 7, 2009 at 8:13 PM, Daniel Richman
applemaill...@mm.danielrichman.com wrote:
But your app could be running on a 32 bit only machine, so 64 bit is not a
bet to make if you want this program to work on unknown machines. Use
-doubleValue to get at least 64 bits, guaranteed.
!!!
Thanks for correcting that. I'd forgotten that long long existed.
--Daniel Richman
Kyle Sluder wrote:
On Sat, Mar 7, 2009 at 8:13 PM, Daniel Richman
applemaill...@mm.danielrichman.com wrote:
But your app could be running on a 32 bit only machine, so 64 bit is not a
bet to make if you want
This is a test app that I'm using to test a concept (nothing to ever
release), and I came across this oddity.
As for the build settings, it was set for 32 bit architecture. I set
it to 32/64 bit, and also Native Architecture of Build Machine, but
after cleaning and building again, I get
Dave DeLong (davedel...@me.com) 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.
On Mar 7, 2009, at 6:35 PM, Dave DeLong wrote:
As for the build settings, it was set for 32 bit architecture. I
set it to 32/64 bit, and also Native Architecture of Build
Machine, but after cleaning and building again, I get the same log
message.
Native architecture of build machine
On Sat, Mar 7, 2009 at 8:41 PM, Sean McBride cwat...@cam.org wrote:
Also, if you want a 64 bit integer, use int64_t. NSInteger changes size
depending, as others have said.
long long matches up with the method names used in Cocoa. I find it
a lot easier to use that rather than int64_t.
--Kyle
Doh! The architecture was still set on i386.
Once I changed it to x86_64, I got the correct log message.
Looks like I still got some learning to do about how Xcode works. =)
Thanks for the help, everyone!
Dave
On Mar 7, 2009, at 6:41 PM, Nick Zitzmann wrote:
On Mar 7, 2009, at 6:35 PM,
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
11 matches
Mail list logo