#if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64

typedef long NSInteger;

typedef unsigned long NSUInteger;

#else

typedef int NSInteger;

typedef unsigned int NSUInteger;

 
NSInteger是一个封装,它会识别当前操作系统的位数,自动返回最大的类型。
当你不知道你的操作系统是什么类型的时候,你通常会想要使用NSInteger,所以或许你想要你的int类型范围尽可能的大,用 NSInteger,32位系统NSInteger是一个int,即32位,但当时64位系统时,NSInteger便是64位的。——所以就是一般推荐 用NSInteger的

NSInteger 和 int 区别的更多相关文章

  1. nsinteger 与 int 区别

    在苹果的api实现中,NSInteger是一个封装,它会识别当前操作系统的位数,自动返回最大的类型.   当你不知道你的操作系统是什么类型的时候,你通常会想要使用NSInteger,所以或许你想要你的 ...

  2. NSUInteger和NSInteger和int

    int和NSInteger其实是差不多的,但更推荐使用NSInteger,因为使用NSInteger,这样就不用考虑设备是32位还是64位了. NSUInteger是无符号的,即没有负数,NSInte ...

  3. integer与int区别以及integer.values()方法详解

    声明:本文为博主转载文章,原文地址见文末. 知识点1:integer和int的区别 /* * int是java提供的8种原始数据类型之一.Java为每个原始类型提供了封装类,Integer是java为 ...

  4. Incompatible integer to pointer conversion assigning to 'NSInteger *' (aka 'int *') from 'NSInteger' (aka 'int')

    遇到这样的问题: integer to pointer conversion assigning to 'NSInteger *' (aka 'int *') from 'NSInteger' (ak ...

  5. Integer与int区别

    Integer与int的区别:估计大多数人只会说道两点,一开始我也不太清楚,Ingeter是int的包装类,int的初值为0,Ingeter的初值为null.但是如果面试官再问一下Integer i ...

  6. size_t和unsigned int区别

    size_t和unsigned int有所不同,size_t的取值range是目标平台下最大可能的数组尺寸,一些平台下size_t的范围小于int的正数范围,又或者大于unsigned int.最典型 ...

  7. tinyint、smallint、bigint、int 区别

    1byte=8bit   [tinyint] 从 0 到 255 的整型数据.存储大小为 1 字节.如果设置为UNSIGNED类型,只能存储从0到255的整数,不能用来储存负数. [smallint] ...

  8. [C/C++] 输入函数getline(cin,str) 与cin.getline(str,int)区别

    cin.getline()函数是处理数组字符串的,其原型为cin.getline(char * , int),第一个参数为一个char指针,第二个参数为数组字符串长度. getline(cin,str ...

  9. size_t 与 int 区别

    size_t是无符号的,并且是平台无关的,表示0-MAXINT的范围, 但是如果传入的是负数,会被编译成他的补码. size_t是标准规定的一个同义词,它的原始定义放在stddef.h里面,不同的环境 ...

随机推荐

  1. python学习-day11-内建函数

    python-内建函数 -int:将字符串转换为数字 a = " print(type(a),a) b = int(a) print(type(b),b) num = " v = ...

  2. [Issue]repo/repo init-解决同步源码Cannot get http://gerrit.googlesource.com/git-repo/clone.bundle

    1. 前两天想搭建freescale L3.0.35_4.1.0_BSP包,结果LTIB环境搭建好,也编译出rootfs/uboot/kernel的Image了,但是准备移植uboot的时候发现ubo ...

  3. select,epool,pool解释

    内容主要来自搜狗实验室技术交流文档, 编写链接数巨大的高负载服务器程序时,经典的多线程模式和select模式都不再适合了.应该采用epool/kqueue/dev_pool来捕获IO事件. ----- ...

  4. [linux basic]--线程

    /************************************************************************* > File Name: thread1.c ...

  5. iphone Dev 开发实例9:Create Grid Layout Using UICollectionView in iOS 6

    In this tutorial, we will build a simple app to display a collection of recipe photos in grid layout ...

  6. HDU 1213 How Many Tables(并查集,简单)

    题解:1 2,2 3,4 5,是朋友,所以可以坐一起,求最小的桌子数,那就是2个,因为1 2 3坐一桌,4 5坐一桌.简单的并查集应用,但注意题意是从1到n的,所以要减1. 代码: #include ...

  7. image和字节流之间的相互转换

    //将图片转化为长二进制 public Byte[] SetImgToByte(string imgPath) { FileStream file = new FileStream(imgPath, ...

  8. repo安装

    repo是使用python开发的一个用于多版本管理的工具,可以和git协作,简化git的多版本管理. repo安装: 1.新建~/bin,并将此目录包含在path变量中(如果已存在,且已在path变量 ...

  9. uboot 、内核、文件系统移植

    1. 参考下面博客: http://blog.csdn.net/andylauren/article/details/51448353 2.查看u盘: $ sudo fdisk -l 3. 格式化u盘 ...

  10. 在每次request请求时变化session

    session.invalidate();//使得当前的session失效 request.getSession(true).getId();//生成一个新的session 原理: request.g ...