How to detect where NaN is passing to CoreGraphics API on Mac OS X 10.9

前端 未结 5 580
一个人的身影
一个人的身影 2021-01-31 08:04

I have very large graphic Mac app and now I receive a lot of the following messages in Console on 10.9 GM.

: Error: this application, or a library i         


        
5条回答
  •  深忆病人
    2021-01-31 08:51

    so you should get an exception at that point, so an exception breakpoint should work...

    here are things to look out for...

    you may have messed up a method signature... ie

    -(float)myHeight
    {
        return 56.0;
    }
    

    gets messed up in a subclass

    -(int)myHeight
    {
        return 42;
    }
    

    or you have some bad math(s) that emit a NaN...

    there are a couple of ways to detect a NaN... c99 introduced isnan()
    also the ieee float trick of (f != f) will be true for NaN

提交回复
热议问题