Cocos2d iphone -1>;8.比较两个整数,negativeOne和八个diff than(negativeOne+;1)和(八个+;1)
代码如下:Cocos2d iphone -1>;8.比较两个整数,negativeOne和八个diff than(negativeOne+;1)和(八个+;1),cocos2d-iphone,evaluate,Cocos2d Iphone,Evaluate,代码如下: while((fingerYLast - fingerAt.y) > fingerMoveThresh) { if( (activeCard) < (allCardList.count - 2)) { [self sayOut:@"TRUE"]; activeCard = activeCard + 1; } else {
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;
}
while((fingerYLast-fingerAt.y)>fingerMoveThresh)
{
如果((活动卡)<(allCardList.count-2))
{
[自言自语:@“真的”];
活动卡=活动卡+1;
}
其他的
{
//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
activeCard=-1;
(activeCard)<(allCardList.count-2)//计算结果为false
(activeCard+1)<(allCardList.count-1)//计算结果为true
有什么想法吗?我不使用那种语言编写代码,但我打赌allCardList.count返回一个无符号的数量,-2,如果试图将其推到零以下,将返回一个非常大的无符号数字。activeCard的类型是什么?抱歉,activeCard是int,allCardList是一个NSMutableArray。