This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: casting on 64/32-bit environment
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: "Mitja Ursic" <mitja dot ursic at email dot si>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 12 Oct 2007 14:11:08 +0100
- Subject: Re: casting on 64/32-bit environment
- References: <20071012130159.5F8FB8B750@www1.email.si>
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.