Re: NSInteger and NSUInteger


Steve Christensen
 

On Jul 10, 2017, at 6:13 AM, Steve Mills <sjmills@...> wrote:

On Jul 10, 2017, at 04:54:24, Gerriet M. Denkmann <g@...> wrote:

Formats for NS(U)Integer:
%t… (%td, %to, %tu %tx, %tX) for unsigned results NSUInteger
%z… (%zd, %zo, %zu %zx, %zX) for signed results NSInteger

Where did you find this info? I've seen mention of them, but never an official type doc that lists them.

General information on format specifiers is here:


I use %td for NSInteger and %tu for NSUInteger. The 't' is a length modifier specifying that a following d, o, u, x, or X conversion specifier applies to a ptrdiff_t or the corresponding unsigned integer type argument. That allows you to use the same format specifier for both 32- and 64-bit platforms, get the correct results, and avoid compiler warnings.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.