Cast from pointer to smaller type 'int' loses
来源:互联网 发布:英语作文批改软件 编辑:程序博客网 时间:2024/06/05 18:32
今天要写一个联系人搜索算法。百度了下, 在code4App中找到相关代码。但是自己跑了下, 发现报错。错误内容如下:Cast from pointer to smaller type int loses inf
Cast from pointer to smaller type 'int' loses information
不经意之间,我的程序从XCode 4.6升级到XCode 5.0后,打开原来的iOS程序,出现了以上的错误!
你需要知道
在iOS编程中,经常会使用C或者C++混编的情况。
在C和C++编程中,经常将指针转化为int类型。
因为在32位的系统中,指针占有4个字节(当然有2个字节的指针,别钻牛角)的空间;int也占有4个字节的空间。这样,转化是没有精度损耗的。OK。
错误原因
当在Xcode 5中编译时,由于编译项:
对的,因为Xcode 支持64位系统。那么,指针在64位操作系统下占有8个字节的空间,而int占有4个字节的空间;这时候,就出问题了,将8字节的指针转化位4个字节的int,当然会发生精度的损耗。
解决方法
1.更改Xcode的编译项Architectures,也就是Build settings里面把Architectures里面的$(ARCHS_STANDARD)去掉,,加入armv7和armv7s两个。
2.将8字节的指针强制转化为8个字节的long 类型。
0 0
- Cast from pointer to smaller type 'int' loses information
- Cast from pointer to smaller type 'int' loses information
- Cast from pointer to smaller type 'int' loses information解决方案
- Cast from pointer to smaller type 'int' loses
- xcode更新到5.1,"Cast from pointer to smaller type 'int' loses information” in EAGLView.mm
- xcode更新到5.1,"Cast from pointer to smaller type 'int' loses information” in EAGLView.mm
- iOS开发 - "Cast from pointer to smaller type 'int' loses information” 解决办法
- Xcode更新到5.1,"Cast from pointer to smaller type 'int' loses information” in EAGLView.mm
- Xcode错误"Cast from pointer to smaller type 'int' loses information”
- iOS开发 - "Cast from pointer to smaller type 'int' loses information” 解决办法
- iOS开发 - "Cast from pointer to smaller type 'int' loses information” 解决办法
- cast from 'void *' to 'int' loses precision
- error: cast from ‘char*’ to ‘int’ loses precision
- error: cast from ‘void*’ to ‘int’ loses precision
- error: cast from ‘char*’ to ‘int’ loses precision
- x86_64 xercexc: error: cast from 'const void*' to 'long int' loses precision [-fpermissive]
- 关于Linux下C编译错误(警告)cast from 'void*' to 'int' loses precision
- 关于Linux下C编译错误(警告)cast from 'void*' to 'int' loses precision
- IOS CGAffineTransform视图平移,放缩,旋转
- hdu 4284 floyed+状态压缩dp
- Python 学习笔记之读写模式
- 第六周项目1(1)-深复制体验
- 欢迎使用CSDN-markdown编辑器
- Cast from pointer to smaller type 'int' loses
- android分包
- protobuf搭建环境,序列化示例
- C语言之结构体
- 类型/结构定义
- 灵活、易用、强大的TS切片和M3U8构建工具
- 使用Vitamio打造自己的Android万能播放器(12)—— 播放网络视频缓冲处理
- zoj3862 intersection[2015浙大校赛C题]
- mybatis中的日志配置