-Wsign-compare to strict?

Gerald Pfeifer pfeifer@dbai.tuwien.ac.at
Wed Mar 10 12:53:00 GMT 1999


The following snippet

  bool f();

  void g(unsigned u) {
     if( u > 1 );
     if( u > 2 );
     if( u > (f() ? 1 : 2) ) ;
     }

generates a warning which I really don't like[TM]

  x.cc: In function `void g(unsigned int)':
  x.cc:6: warning: comparison between signed and unsigned

when compiled with `egcs-current-cvs -Wsign-compare`

Note that this only occurs with the ? : expression, not in the other
two cases.

Gerald
-- 
Gerald "Jerry" pfeifer@dbai.tuwien.ac.at http://www.dbai.tuwien.ac.at/~pfeifer/



More information about the Gcc-bugs mailing list