I have something funny happening when I compile (gcc)
I have two variables:
and when I used them in a for loop condition:
I get a compiler warning:
" warning: comparison between signed and unsigned "
so since my "i" is unsigned, the x*y must have been converted to signed.......
I know it's being converted to a 32 bit int because sizeof = 4
Can someone tell me what's going on?
thanks!!
p.s. i know that it's bad practice to compute in the condition
I have two variables:
Code:
unsigned short x; unsigned short y;
and when I used them in a for loop condition:
Code:
unsigned int i;
for( i = 0 ; i < x * y ; i++ )
{ ; }
I get a compiler warning:
" warning: comparison between signed and unsigned "
so since my "i" is unsigned, the x*y must have been converted to signed.......
I know it's being converted to a 32 bit int because sizeof = 4
Can someone tell me what's going on?
thanks!!
p.s. i know that it's bad practice to compute in the condition
Comment