GCC casts short to int
Leonitis
rubixqb@gmail.com
Thu Jun 25 14:30:00 GMT 2009
Andrew Haley wrote:
>
>
> Right, so you *must* prevent the overflow. Why do you need the signed
> overflow anyway? Can't you use unsigned arithmetic?
>
> Like this:
>
> unsigned int c;
> unsigned short a = 0;
> unsigned short b = 0;
>
>
Thanks Andrew! That totally did the trick.
I didn't need to use signed arithmetic for my purposes, but I can see why
GCC was so stubborn about converting those short variables to integers.
The assembly code now does the two shifts that I wanted to see.
--
View this message in context: http://www.nabble.com/GCC-casts-short-to-int-tp24203223p24204360.html
Sent from the gcc - Help mailing list archive at Nabble.com.
More information about the Gcc-help
mailing list