0 < negative loop condition bug or misunderstanding on my part
Andrej Mitrovic
andrej.mitrovich at gmail.com
Wed Mar 7 06:19:35 PST 2012
On 3/7/12, Timon Gehr <timon.gehr at gmx.ch> wrote:
> The problem is not that length is unsigned. The issue is the implicit
> conversion from signed to unsigned.
You bet. I've once had this hard to spot bug where I've used a call
that was something like max(0, min(10, <expression>)), and this ended
up returning a negative int because <expression> was combining an
integer with a .length property of some array (I don't recall the
exact call though). It was truly a WTF moment.
More information about the Digitalmars-d-learn
mailing list