Boost logo

Boost :

From: Wynand Winterbach (wynand_at_[hidden])
Date: 2003-10-31 11:07:53


On Thu, Oct 30, 2003 at 12:06:08PM -0700, Dave Gomboc wrote:
> # 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, this is what I was saying. And no, not only "beginners" would be
surprised, since one might actually be too busy sorting out other
thoughts related to an algorithm to notice.

> Dave
>
> [resend; apology if appears more than once]
>

--Wynand


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk