Alternatives to type casting when formatting NS(U)Integer on 32 and 64 bit architectures?

前端 未结 3 1802
粉色の甜心
粉色の甜心 2020-12-12 13:39

With the 64 bit version of iOS we can\'t use %d and %u anymore to format NSInteger and NSUInteger. Because for 64 bit tho

3条回答
  •  感情败类
    2020-12-12 14:23

    According to Building 32-bit Like 64-bit, another solution is to define the NS_BUILD_32_LIKE_64 macro, and then you can simply use the %ld and %lu specifiers with NSInteger and NSUInteger without casting and without warnings.

提交回复
热议问题