> On Oct 17, 2016, at 11:23 PM, Patrick J. Collins > <[email protected]> wrote: > > I just got an iPad pro over the weekend to make sure my app worked on > it, and sure enough, it didn't... After spending a ton of time > debugging, I finally figured out what the deal is, and honestly, I do > not understand it at all. Here is the problem: > > > (lldb) expr (float)[self.fireable laserXOffset] > (float) $11 = 0 > (lldb) expr (CGFloat)[self.fireable laserXOffset] > (CGFloat) $12 = 400 > > ???? > > Why in the world is it so picky that casting a CGFloat as a float will return > a 0 value? That just seems like insanity. > > I see this: > > #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 > > Yet if I do: > > (lldb) expr (double)[self.fireable laserXOffset] > (double) $15 = 400 > > So........ CGFloat is a float, yet it returns 0??????????? WTF?
Is your process 64-bit or 32-bit? CGFloat is float in 32-bit processes and double in 64-bit processes. I don't think iPad Pro differs from any other 64-bit iOS device. Do you get the same result if you run that code in your app instead of on the debugger console? The debugger console may interpret it differently (using the cast as a hint of the correct return type, rather than a conversion of the real return type). -- Greg Parker [email protected] <mailto:[email protected]> Runtime Wrangler
_______________________________________________ Do not post admin requests to the list. They will be ignored. Objc-language mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/objc-language/archive%40mail-archive.com This email sent to [email protected]
