reintepret_cast double into `unsigned long long'

Hi all,

I received compilation errors when trying to reinterpret_cast a double into an `unsigned long long’ integer. My codes is as follows:

const double A = 1.0;
const unsigned long long B = reinterpret_cast(A);

The compilation error is: invalid type conversion. My host is running Linux 64-bit, CUDA version is 3.0 beta. I think on this machine unsigned long long should be interpreted as 64-bit and this cast should be working… Thanks a lot for any hint on what’s wrong.

It seems that this is a C++ specific question. it should be written like:

B = reinterpret_cast<unsigned long long&>(A);

This is the grammatical design for how reinterpret_cast should be used.