> Is your process 64-bit or 32-bit? CGFloat is float in 32-bit processes and 
> double in 64-bit processes.

I'm not sure what you mean?  The app is intended to work on both 32-bit
and 64-bit architectures.  My iPad3 is a 32-bit device, and my iPhone-6
is a 64-bit device.  On both of those devices everything is fine and
casting 1.0 as either a CGFloat or float with both result in 1.0 (as
expected).  On the iPad pro, this bogus behavior happens where 1.0 cast
as a CGFloat becomes 0.

> I don't think iPad Pro differs from any other 64-bit iOS device.

It totally does as I've just explained.

> 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).

Yes, when I first tried my game on the iPad pro, a huge percentage of my
sprites were invisible, and it was because their scale was being set to
1.0 as CGFloats, which was turning into 0.  So I had to make sure all
the places where scale was being set was using an actual float type.

Total nonsense...

And now like I said, I am so nervous that there are many 0's lurking out
there that I'm not aware of.  I feel like I should just sed -i my entire
project and turn all CGFloats into floats... But I am not sure if that's
really a good idea.

Patrick J. Collins

On Mon, 17 Oct 2016, Greg Parker wrote:

>       On Oct 17, 2016, at 11:23 PM, Patrick J. Collins 
> <patr...@collinatorstudios.com> 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
> #else
> # define CGFLOAT_TYPE float
> # define CGFLOAT_IS_DOUBLE 0
> #endif
> Yet if I do:
>  (lldb) expr (double)[self.fireable laserXOffset]
>  (double) $15 = 400
> So........  CGFloat is a float, yet it returns 0??????????? WTF?
> -- 
> Greg Parker     gpar...@apple.com     Runtime Wrangler
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (Objc-language@lists.apple.com)
Help/Unsubscribe/Update your Subscription:

This email sent to arch...@mail-archive.com

Reply via email to