I wrote a C++ application on Win64 with these lines:
Window* wnd = 0;
long l = reinterpret_cast<long> ( wnd );
The compiler displays the following error at the last line:
error: cast from 'window::Window*' to 'long int' loses precision [-fpermissive]
I use this value to put it into SetWindowLong (WindowsAPI) function.
I cannot understand this error. I am using MinGW-w64 (ruben build).
Read my original comment.
The issue is that
sizeof(window::Window *)is greater thansizeof(long), meaning you can’t effectively store the value of the pointer inl. This explains the error.Now, what you should really want is actually to use
SetWindowLongPtrinstead.