参考Objective-C中的转换为绝对值我想知道NS typedefed类型是否有函数.还是abs(NSInteger)没事?它是架构安全的吗?
小智 18
你可以使用Foundation的ABS()宏:
NSInteger a = 5;
NSInteger b = -5;
NSLog(@"%ld %ld", ABS(a), ABS(b));
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8573 次 |
| 最近记录: |