iosxcodecocoa-touchnsmutablearraynspointerarray

NSMutableArray with [NSNull null] vs NSPointerArray


I am writing a chess program that stores all the pieces in an NSMutableArray with [NSNull null] representing empty spaces. I just found out about NSPointerArray and was wondering if I should switch over to that instead. Basically, what are the pros/cons of using an NSMutableArray with [NSNull null] values vs an NSPointerArray?


Solution

  • If you are putting objects in the NSMutableArray as well, say the chess pieces, stay with NSMutableArray. Also there is really no reason not to use [NSNull null], really not much different that putting a NULL in a NSPointerArray.

    If you are concerned about performance measure before making any change.