This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: bugs in simple for loop
- To: clee at rrkm dot ajou dot ac dot kr (ÀÌ Ãµ¿ì ±³¼ö x2606)
- Subject: Re: bugs in simple for loop
- From: Andi Kleen <ak at muc dot de>
- Date: 14 Jan 1999 18:40:31 +0100
- cc: egcs at cygnus dot com
- References: <199901141307.WAA01340@rrkm.ajou.ac.kr>
In article <199901141307.WAA01340@rrkm.ajou.ac.kr>,
clee@rrkm.ajou.ac.kr (ÀÌ Ãµ¿ì ±³¼ö (x2606)) writes:
> 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 is normally a unsigned type, so i >= 0 is always true. If you
would have compiled with -Wall gcc would have told you.
-Andi