我想将一个无符号整数 * 类型的指针(也定义为 std::size_t)传递给 MKL 函数,该函数期望它是 long long * ,虽然两者都是 64 位整数,但我得到类型不兼容错误。我在 64 位整数模式下使用 MKL。有什么帮助吗?谢谢
问问题
654 次
1 回答
0
#include <limits.h>
int main() {
unsigned int i = UINT_MAX;
unsigned int iptr = &i
// In writing this, I realized that you have to change the original
// or declare a new llong, but remember that
// returning a pointer to a local is bad. Change the original if you can.
if(i > LLONG_MAX) i = LLONG_MAX;
long long *lptr = (long long *)i;
}
于 2011-09-01T15:48:55.753 回答