linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* ppc_8xx-gcc from eldk strange behaviour
@ 2007-08-28 18:56 DI BACCO ANTONIO - technolabs
  2007-08-28 19:01 ` Scott Wood
  2007-08-29  4:50 ` Ricardo Scop
  0 siblings, 2 replies; 5+ messages in thread
From: DI BACCO ANTONIO - technolabs @ 2007-08-28 18:56 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 1127 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-29 23:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-28 18:56 ppc_8xx-gcc from eldk strange behaviour DI BACCO ANTONIO - technolabs
2007-08-28 19:01 ` Scott Wood
2007-08-29  9:28   ` DI BACCO ANTONIO - technolabs
2007-08-29 23:28     ` Wolfgang Denk
2007-08-29  4:50 ` Ricardo Scop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).