Is there an appropriate structure provided in the Apple foundation kits to represent discrete coordinate systems? I know I can just use the integral component of NSPoint and by convention keep it discrete, or even define my own.
However if there is one already which is typed correctly I would prefer that and avoid implicit / explicit type nastiness.
I’m not aware of one that serves your exact needs. You could certainly use
CGPointorNSPoint, but since you know the values will be discrete integers, why waste the precision on a non-existent fractional part? In addition, repeated casts to integer values would get old quickly. You’d be much better served to create your own typedef using integer types, like so:You could also use
int32_tinstead ofNSIntegerif you know the values will never exceed the 32-bit range — this will conserve some space in 64-bit mode. (See this SO question for details aboutNSInteger, etc.)