|
Boost : |
From: Dave Gomboc (dave_at_[hidden])
Date: 2003-10-30 14:06:08
# for ( unsigned i = 5; i >= 0; i-- ) { cout << blah[i]; }
#
# This fails i can never become -1. Actually, you'll have an
# infinite loop.
If your intent is to compare "i >= 0", then your intent is to test
whether i is negative or non-negative. It would be completely illogical
to declare i unsigned, and only beginners would be surprised that this
is wrong.
Dave
[resend; apology if appears more than once]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk