以下是代码:
while((fingerYLast - fingerAt.y) > fingerMoveThresh)
{
if( (activeCard) < (allCardList.count - 2))
{
[self sayOut:@"TRUE"];
activeCard = activeCard + 1;
}
else
{
//WTF????
[self sayOut:[NSString stringWithFormat:@"FALSE %i %i",
activeCard, (allCardList.count - 2)]];
}
fingerYLast -= fingerMoveThresh;
}
我检查了测试值,activeCard为-1,allCardList有10个成员。
activeCard = -1;
(activeCard) < (allCardList.count - 2) //evaluates as false
(activeCard+1) < (allCardList.count - 1) //evaluates as true
有什么想法吗?
答案 0 :(得分:3)
我不会用那种语言编码,但我的赌注是allCardList.count返回一个无符号数量和-2,试图将它推到零以下,将返回一个非常大的无符号数。