我应该如何在Objective-C中声明一个long? NSInteger合适吗? [英] How should I declare a long in Objective-C? Is NSInteger appropriate?
本文介绍了我应该如何在Objective-C中声明一个long? NSInteger合适吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我看到 NSInteger
经常被使用,并且iPhone上的 typedef
很长,所以技术上很长当我期望int(64)值时,我可以使用它。但是我应该更明确地使用类似 int64_t
或者直接使用吗?使用long会有什么缺点?
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?
推荐答案
IIRC, long
是32位。如果你想要一个保证的64位整数,你应该(确实)使用 int64_t
。
IIRC, long
on the iPhone/ARM is 32 bits. If you want a guaranteed 64-bit integer, you should (indeed) use int64_t
.
这篇关于我应该如何在Objective-C中声明一个long? NSInteger合适吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文