casting on 64/32-bit environment

Andrew Haley aph-gcc@littlepinkcloud.COM
Fri Oct 12 13:11:00 GMT 2007


Mitja Ursic writes:

 > Compiling of a cc program with g++ on 64-bit environment gives me a warning of 
 > a type ?Warning: cast from pointer to integer of different size? on a place 
 > were casting really takes place. If I compile the same program on 32-bit 
 > environment I don?t have warning anymore.
 > Dose anyone have a reasonable explanation about that?

The problem here is that we don't know what you don't understand.

If you're casting a pointer to an (32-bit) int, then if you are on a
64-bit system, there will be overflow and some information will be
lost.  If you're on a 32-bit system then there won't be a problem.
This seems obvious: what's the problem?

Andrew.



More information about the Gcc-help mailing list