
1 finab OP count 方法返回的是 NSUInteger ,我的 index 是 NSInteger 这两种数据类型比较会存在问题吧 |
2 fogisland Nov 30, 2015 @finab 这是 C 语言的范畴了, int 会被强转为 uint ,因此 -1 > _group.count ; 直接写 -1 > 2 返回 false, 是因为常数的默认类型都是 int , 不会发生类型转换 |
3 loveuqian Nov 30, 2015 via iPhone 为啥你自定义类 view 是小写字母开头 |
4 finab OP @fogisland 我比较好奇的是 int 与 uint 比较,会把 int 转成 uint, 而不是将 uint 转成 int - - NSLog(@"%u", -1); // 输出 4294967295 |
6 fogisland Nov 30, 2015 @finab 给你个链接看看: https://www.securecoding.cert.org/confluence/display/cplusplus/INT02-CPP.+Uderstand+integer+conversion+rules "If the operand that has unsigned integer type has rank greater than or equal to the rank of the type of the other operand, the operand with signed integer type is converted to the type of the operand with unsigned integer type." |
8 wizardforcel Nov 30, 2015 via Android |
9 surfire91 Nov 30, 2015 @wizardforcel 这还不是溢出? |
10 wezzard Nov 30, 2015 lou zhu zai diao yu. |