Cast from pointer to smaller type 'int' loses information解决方案
2015-03-07 11:09
711 查看
要适配amr64了,结果好多第三方库出了问题
searchPosMallocArray.Append(&searchPosMallocArray,(int)searchPosMalloc);
这句话报了Cast from pointer to smaller type 'int' loses information的错
如果指针是64位和整数都是32位的,一个int是太小,无法容纳一个指针的值。所以可能是这个原因造成的。
那么我们只该代码改成
searchPosMallocArray.Append(&searchPosMallocArray,(int)(size_t)searchPosMalloc);
就不会报错了,也就是将原来的(int)改为(int)(size_t)
searchPosMallocArray.Append(&searchPosMallocArray,(int)searchPosMalloc);
这句话报了Cast from pointer to smaller type 'int' loses information的错
如果指针是64位和整数都是32位的,一个int是太小,无法容纳一个指针的值。所以可能是这个原因造成的。
那么我们只该代码改成
searchPosMallocArray.Append(&searchPosMallocArray,(int)(size_t)searchPosMalloc);
就不会报错了,也就是将原来的(int)改为(int)(size_t)
相关文章推荐
- 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” 解决办法
- iOS开发 - "Cast from pointer to smaller type 'int' loses information” 解决的方法
- 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更新到5.1,"Cast from pointer to smaller type 'int' loses information” in EAGLView.mm
- Cast from pointer to smaller type 'int' loses information
- "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”
- Cast from pointer to smaller type 'int' loses
- x86_64 xercexc: error: cast from 'const void*' to 'long int' loses precision [-fpermissive]
- cast from 'void *' to 'int' loses precision
- incompatible pointer types assigning to 'int *' from 'char'
- Conversion from 'void*' to pointer to non-'void' requires an explicit cast
- 解决cast from 'char*' to 'char**' increases required alignment of target type [-Werror=cast-align]
- error C2440: 'static_cast' : cannot convert from 'void (__thiscall CMainFrame::* )(void)' to 'LRESUL
- Unable to cast COM object of type 'Word.ApplicationClass' to interface type 'Word._Application'"
- vs2005 warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data