Compiling this program using -Wall -Wcast-qual: >>>>
#include <stdio.h> int main(int argc, char *argv[]) { unsigned char u; u = '\377'; printf("u=%i\n", u); /* 255, as expected */ /* if (u != '\0')*/ /* ok */ if (u != '\377') /* ERROR (?) : always true due to limited range of data type */ printf("wow"); return(0); } <<<< gives the warning "comparison is always true due to limited range of data type" platform is i386/Pentium 4M running FreeBSD 6.2-BETA3 Note the operator != Also, the complementary comparison u != '\0' does *not* give a warning "comparison is always false due to limited data type" -- Summary: u != '\377' always true (u is unsigned char) Product: gcc Version: 3.4.6 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: r dot c dot ladan at gmail dot com GCC build triplet: i386-undermydesk-freebsd GCC host triplet: i386-undermydesk-freebsd GCC target triplet: i386-undermydesk-freebsd http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29771