Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I declare a long in Objective-C? Is NSInteger appropriate?

I see NSInteger is used quite often and the typedef for it on the iPhone is a long, so technically I could use it when I am expect int(64) values. But should I be more explicit and use something like int64_t or long directly? What would be the downside of just using long?

like image 770
Brennan Avatar asked Jun 06 '10 16:06

Brennan


1 Answers

IIRC, long on the iPhone/ARM is 32 bits. If you want a guaranteed 64-bit integer, you should (indeed) use int64_t.

like image 84
Wevah Avatar answered Sep 22 '22 11:09

Wevah