IN IOS WHAT WE PREFER NSINTEGER OR INT

Glen Martin

Total Post:27

Points:191
Posted by  Glen Martin
 467  View(s)
Ratings:
Rate this:

Can any one tell me the benefit to using the NS types our the built-ins. and which we prefer and why?

Is int and NSInteger has the same width on 32/64 bit platforms?

  1. Tarun Kumar

    Post:214

    Points:1642
    Re: In iOS what we prefer NSInteger or int

    In my according NSInteger have all the features of safe architecture versions of the corresponding C types, basically its size changes depending on the architecture. and NSInteger is guaranteed to hold any valid pointer for the current architecture.

    Apple also recommends that you use these to work with OS-X and onwards, and Apple's APIs will use them, so it is definitely a good idea to get into the habit of using them. It require a little more typing, but it is a part from that it doesn't seem to be any reason not to use them.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!