At work, I’ve been trying to get a new version of Red Hat Linux installed on a computer, and more importantly, to run a custom bit of code. When I made this upgrade, I noticed the following error:
cast from ‘void*’ to ‘int’ loses precision
In addtion, I’ve been noticing a string of other errors based from a library which forces use to 32 bit addresses. They seem to result from essentially type casting an in to a custom library 32 bit value.
Bottom line is this. I believe that the compiler has changed the default size of an int from 32 bit to 64 bit. I’m trying to figure out if this is the case without writing a trivial program to determine the size of the integer. In addition, is there a way to force the size back to 32 bits, at least as a proof of concept?
If you’re on an x86_64 box,
intis still 4 bytes. if it was 8, the compiler would not tell youbecause there would be no precision to lose. what it’s telling you that your trying to cram an 8byte pointer to a 4byte int, that’s quite obviously going to lose a bit of information.
also, and this is just a sidenote, how hard can it be to write this?