How to force gcc warn the conditions which are true of false forever?

Pan ruochen panruochen@gmail.com
Tue Nov 4 11:37:00 GMT 2008


Hi All,

gcc (version 3.4.5) will optimize the following code without any
warnings even with -Wall options
--------------------------------------
if (id < 0 && id > 3)
{
          printf("Failed.\n");
          return ;
}
--------------------------------------
How should I do if I do want gcc to give warnings about these code,
since in most cases
such code are really mistakes?

Best Regards
---------------
PRC
Nov 4, 2008



More information about the Gcc-help mailing list