In Objective-C, fabsf () has the wrong result type

If in the Xcode debug console, type

(lldb) p (float)fabsf(-5.0f) (float) $22 = 0 (lldb) p (double)fabsf(-5.0f) (double) $23 = 5 

where the first casting result for float (without casting, the p command cannot recognize the return type fabsf ) is incorrect regardless of the parameter .

But in the library headers, the return type fabs clearly a float. Can someone explain this to me?

ios9.2: math.h

 ... extern float fabsf(float); extern double fabs(double); extern long double fabsl(long double); ... 

Is there any lldb mechanism or problem that I don't know about, or is it really a language implementation problem (guess not ...)?

+5
source share
1 answer

In Xcode 7, there was a fairly confident lldb console error, and a ticket was created for it.

The problem is no longer present in Xcode 8.0.

+3
source

Source: https://habr.com/ru/post/1242022/


All Articles