Friday, November 13, 2015

Difference Between CGFloat, float, and double

CGFloat is a typedef for either float or double.  On 32-bit systems it is a float, on 64-bit systems it's a double.  In these days, just about all iPhones are 64-bit.  According to one SO commenter, on 64-bit phones 32-bit apps are run on another shared cache pool in memory which can result in using more memory overall.

In my opinion, when in doubt, just use CGFloat.  Use the primitives only if you specifically need to.

Reference:
http://stackoverflow.com/questions/1264924/whats-the-difference-between-using-cgfloat-and-float

No comments:

Post a Comment