开发者

using pointers to unsigned long integers instead of long long integers in c++

开发者 https://www.devze.com 2023-04-01 01:55 出处:网络
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

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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消