I am trying to use <tgmath.h> to reduce casting while using CGFloat, as recommended:
http://www.omnigroup.com/mailman/archive/macosx-dev/2009-June/062331.htmlBut it's not working as I expect. For example, this code is giving me trouble when compiled for 64-bit:
// CGFloat zoomLevel;
(is an ivar)
CGFloat scale = pow(2.0f, -zoomLevel);
Unless I change the function call to pow(2.0f, -(float)zoomLevel), I get "warning: implicit conversion shortens 64-bit value into a 32-bit value" when compiling for 64-bit.
Since the second parameter to pow is a double in the original version, the double version of pow should be used, according to
http://www.opengroup.org/onlinepubs/9699919799/basedefs/tgmath.h.htmlThe macros in <tgmath.h> look like they would make that happen.
I tried something much simpler:
__TGMATH_REAL(1.0, fabs);
But even this gives an implicit conversion warning, on all of gcc 4.0, gcc 4.2, llvm-gcc 4.2!
Why is this happening? Am I totally confused as to how tgmath should be working?