alibaba / wax

Wax is a framework that lets you write native iPhone apps in Lua.
http://github.com/probablycorey/wax
MIT License
1.84k stars 280 forks source link

CGFloat VS getIvarDouble, on iPhone5 or earlier device #34

Closed lovecactus closed 8 years ago

lovecactus commented 8 years ago

I've got an issue while accessing CGFloat, using getIvarDouble method.

CGFloat is defined as float on non-64bits platform, while defined as double on 64bits platform.

#if defined(__LP64__) && __LP64__
# define CGFLOAT_TYPE double
# define CGFLOAT_IS_DOUBLE 1
# define CGFLOAT_MIN DBL_MIN
# define CGFLOAT_MAX DBL_MAX
#else
# define CGFLOAT_TYPE float
# define CGFLOAT_IS_DOUBLE 0
# define CGFLOAT_MIN FLT_MIN
# define CGFLOAT_MAX FLT_MAX
#endif

This leads to a problem: When we need to access a member using getIvarXXXX method, we have to determine whether we should use getIvarDouble or getIvarFloat, regarding to platform.

Since we've already have getIvarCGPoint/getIvarCGSize/getIvarCGRect method, it will be very helpful to have a getIvarCGFloat method, which would makes wax easier to use in this case.

intheway commented 8 years ago

it's already have getIvarCGFloat in the latest commit. see https://github.com/alibaba/wax/wiki/privateIvar-CN