using pointers to unsigned long integers instead of long long integers in c++
I want to pass a pointer of type unsigned i开发者_StackOverflownteger * (also defined as std::size_t) to MKL function which expects it to be long long * , although both are 64 bit integers, I get type incompatibility errors. I use MKL in the 64-bit integer mode. Any help ? Thanks
#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;
}
精彩评论