I don't get this one!
#include <stdio.h>
int main()
{
unsigned short t1 = 0, t2 = 0;
if( t1 < t2-1 )
printf(" t1 < t2-1\n");
unsigned long s1 = 0, s2 = 0;
if( s1 < s2-1 )
printf(" s1 < s2-1\n");
}
this results in:
s1 < s2-1
Either both should fail or both not. I tried this with gcc 4 & 4.2
Iam not sure but I suspect that the expression t2-1 automatically widened into an int value. I do not have the c standard here what the exact conversion rules are, but I believe types smaller than int are automatically widened.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With