-1> 8?比较两个整数,negativeOne和八个diff比(negativeOne + 1)和(eight + 1)

时间:2013-05-20 10:54:01

标签: cocos2d-iphone evaluate

以下是代码:

    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

有什么想法吗?

1 个答案:

答案 0 :(得分:3)

我不会用那种语言编码,但我的赌注是allCardList.count返回一个无符号数量和-2,试图将它推到零以下,将返回一个非常大的无符号数。