Re++: bugs in simple for loop
Stefan Drees
sdrees@qwdb.rs.kp.dlr.de
Thu Jan 14 08:40:00 GMT 1999
Hi,
On Thu, 14 Jan 1999, Ruslan Shevchenko answered:
:-) > Dear Sir, Today I found a striking bug. It occurs in the very simple
...
:-) > 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 ?)
g++ -W -Wall -o nobug_for nobug_for.cc
nobug_for.cc: In function `int main()':
nobug_for.cc:5: warning: unsigned value >= 0 is always 1
Sure! Reason ++Inf to **allways** compile with warnings on!
Later,
s t e f a n.
---
Day: Stefan Drees <sdrees@acm.org>, Phone ++49 2203 601 - 3542
Night: Stefan Drees <sdrees@manchmal.rhein.de>, Phone ++49 228 934 35 14
Browse: http://www.sdrees.de/stefan/
More information about the Gcc-bugs
mailing list