http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47931

--- Comment #1 from Martin Sebor <msebor at gmail dot com> 2011-02-28 19:38:15 
UTC ---
To add a suggested solution to my report: Since many (most?) comparisons will
be against NULL which can be defined as either 0 or (void*)0 I think it would
be best to diagnose both forms. To make it possible to easily silence the
warning I suggest not diagnosing cases of comparison against a null pointer
constant of the same type. I.e., like so:

  int i;

  if (&i);               // warning
  if (&i == 0);          // warning
  if (&i == (void*)0);   // warning
  if (&i == (int*)0);    // NO warning

Reply via email to