核心数据整数要使用哪些整数类型 [英] Which integer types to use for Core Data integers

查看:92
本文介绍了核心数据整数要使用哪些整数类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

核心数据具有int16,int32和int64。当以它们的NSNumber形式使用它们时,我应该使用NSInteger或int(以及它们各自的NSNumber方法numberWithInt,numberWithInteger)。我一直将int用于int16,将NSInteger用于int32,但我不知道这是否正确。我想澄清一下。

Core Data has int16, int32, and int64. When working with these in their NSNumber form should I use NSInteger or int ( and their respective NSNumber methods numberWithInt, numberWithInteger ). I have been using int for int16 and NSInteger for int32, but I don't know if this is correct. I would just like some clarification.

推荐答案

NSInteger至少为32位,与int一样。我永远不会使用int16,除非您需要代表一个简短的内容。

NSInteger is at least 32 bit, as is int. I wouldn't ever use int16, unless you need to represent a short.

NSInteger在64位运行时中也可以是64位...

NSInteger can also be 64 bit, in a 64bit runtime...

这篇关于核心数据整数要使用哪些整数类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆