bugs in simple for loop

Manfred Hollstein manfred@s-direktnet.de
Thu Jan 14 09:32:00 GMT 1999


On Thu, 14 January 1999, 17:07:02, Ruslan@Shevchenko.Kiev.UA wrote:

 > ÀÌ Ãµ¿ì ±³¼ö (x2606) wrote:
 > 
 > > Dear Sir, Today I found a striking bug. It occurs in the very simple
 > > situation like the following.
 > >
 > >         #include <cstddef>
 > >         #include <iostream>
 > >
 > >   main(){
 > >                 for(size_t i = 9; i >= 0 ; i-- ) cout << i << endl;
 > >         }
 > >
 > 
 > size_t    *always*   >=0.
 > 
 > So, this is not bug.
 > 
 > (Hmm, is egcs produce warning here ?)

It does already:

$ gcc -c -W t.cc
t.cc: In function `int main()':
t.cc:6: warning: comparison of unsigned expression >= 0 is always true

manfred



More information about the Gcc-bugs mailing list