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

Anandkumar, CB IN BLR SISL anand.cb@siemens.com
Mon Nov 10 11:52:00 GMT 2008


 Hi ruochen,
	I think this should be handled in application rather than
compiler handling it.
	
With regards,
Anandkumar.C.B

-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Pan ruochen
Sent: Tuesday, November 04, 2008 5:07 PM
To: gcc-help@gcc.gnu.org
Subject: How to force gcc warn the conditions which are true of false
forever?

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


 
 
Important notice:This e-mail and any attachment thereto contains corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank You.



More information about the Gcc-help mailing list