How can I get gcc to generate a warning if I compare paired?

I want to catch a comparison of doubling comparisons in my code and get warnings for them. Is there a GCC warning that will do this?

This is not something that can be easily done in source code.

+4
source share
2 answers

GCC 4.7.0 has:

gcc --help=warnings 

and he produces, among many others:

 -Wfloat-equal Warn if testing floating point numbers for equality 

(GCC 4.1.2 does not support extended help, it just has --help . However, it does have a warning option.)

+8
source

A quick man gcc shows this as a likely candidate

  -Wfloat-equal 
+5
source

All Articles