这句话什么意思?
L = ((L == -1) || (L > 0x7fffffff)) ? ((long)0x7fffffff) : L;
希望回答的时候特别说明一下那个“?“什么意思,
还有那个;L什么意思。
还有0x7fffffff什么意思,
最后说一下这句话什么意思
呵呵,是不是多了点,这样我才能真正的了解这句话的意思,麻烦您了 。
------解决方案--------------------L = ((L == -1) || (L > 0x7fffffff)) ? ((long)0x7fffffff) : L;
==>
if( L==-1 || L > 0X7FFFFFF )
{
L = (long)0x7fffffff);
}
else
L 值不变
------解决方案--------------------就是说 如果L == -1成立 L就等于((long)0x7fffffff)
如果 L > 0x7fffffff 成立 L不变
------解决方案--------------------a?b:c
这属性三目运算
?及:是三目运算符
意思是:如果a为true,那么为b,否则为c
------解决方案--------------------L = ((L == -1) || (L > 0x7fffffff)) ? ((long)0x7fffffff) : L;
L是BOOL类型
如果((L == -1) || (L > 0x7fffffff))返回TRUE 则L等于((long)0x7fffffff)
如果((L == -1) || (L > 0x7fffffff))返回FALSE 则L返回原值
((L == -1) || (L > 0x7fffffff))中
如果L == -1或L > 0x7fffffff其中有一个返回TRUE,则返回TRUE
如果L == -1或L > 0x7fffffff两个都返回FALSE,则返回FALSE