Cast from pointer to smaller type ‘int‘ loses information解决方案

要适配arm64了,结果好多第三方库出了问题

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)