I have a line of code that will work differently depending on the datatypes “day” and “1”. I believe it is the following although I will check my source code later.
day = day + 1;
Does this make sense? What would the differences be?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
NSIntegeris a type definition that describes an integer – but it is NOT equivalent tointon 64-bit platforms.You can examine the typedef by cmd-clicking on
NSIntegerin Xcode.NSIntegeris defined asintwhen building a 32-bit app and aslongfor 64-bit apps.Most of the time you can replace int with NSInteger, but there are some things to consider when doing so.
Apple’s 64-Bit Transition Guide for Cocoa has some information about that.
NSNumber is a class that helps you to store numeric types as object. It has methods to convert between different types and methods to retrieve a string representation of your numeric value.
If you use a variable
dayof typeNSNumber*the way you did in your example, you are not modifying the value ofdaybut its memory address.If you are working with time values you also could take a look at NSDate.