Consider the following C code snippet:

#include <stdio.h>

int main()
{
  char x = -4;
    
  if (x < 0)
    printf("x is negative\n");
  else
    printf("x is positive\n");  
}

If I compile it with host gcc, there is no warning and the message "x is 
negative" is printed.
If I compile it with ppc_8xx-gcc there is a warning "main.c:11: warning: 
comparison is always false due to limited range of data type" and the program 
prints message "x is positive". 
To correct the problem I have to put signed before char.

Bye,
Antonio.
_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

Reply via email to