ubyte in for loops
DBloke
someone at somewhere.com
Sat Aug 7 06:19:04 PDT 2010
I declared a variable cnt of ubyte first as part of the for loop
initialiser to 3, then found it odd that the loop went infinite.
I ran through the debugger and first time through it correctly
decrements value and cnt = 2, the next time round it went to -1, this
did not happen when I declared the cnt to be an uint
I then initialised cnt outside the loop and got the same behaviour
The code was
for(ubyte cnt = 3; cnt > 0; --cnt)
{
...
code here
}
More information about the Digitalmars-d-bugs
mailing list