How should I declare a long in Objective-C? Is NSInteger appropriate?

后端 未结 5 721

I see NSInteger is used quite often and the typedef for it on the iPhone is a long, so technically I could use it when I am expect int(64) values.

5条回答
  •  再見小時候
    2021-01-12 12:43

    If you need a type of known specific size, use the type that has that known specific size: int64_t.

    If you need a generic integer type and the size is not important, go ahead and use int or NSInteger.

提交回复
热议问题