gcc doesn't warn that (unsigned > 0) is always true

Falk Hueffner falk.hueffner@student.uni-tuebingen.de
Mon Oct 20 17:38:00 GMT 2003


Daniel Jacobowitz <drow@mvista.com> writes:

> > void a_loop (unsigned int in) {
> >   do {
> >   } while (--in > 0);
> 
> That is not an endless loop.  in == 0 will terminate it.

Other compilers warn about it, however, and the warning could easily
be avoided by using !=. So I think the warning would be sensible.

-- 
	Falk



More information about the Gcc mailing list