简体   繁体   中英

Set maximum value of NSInteger

* Sorry if this has been posted before but I have been looking for 30 mins now and cant find anything *

Hi, I have an NSInteger called currentcoins and I want the coins maximum value to be 999. I have tried everything including

#undef NSIntegerMax
#define NSIntegerMax 999

but the NSInteger isn't taking any notice of this. Has anyone got any solutions? (I'm doing this for iOS)

Thanks in advance.

You should never ever redefine a system define like NSIntegerMax . This is set by the type of system you are building your app for (32 or 64 bit).

Just define your own max like:

#define kMaxCoins 999

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM