In iOS what we prefer NSInteger or int

Total Post:27

Points:191

 903  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. 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

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.