• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
trouble using tgmath
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

trouble using tgmath


  • Subject: trouble using tgmath
  • From: Nathan Vander Wilt <email@hidden>
  • Date: Wed, 30 Sep 2009 21:06:27 -0700

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

But 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.html
The 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?

thanks,
-natevw
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: XIB file contents change depending if IB is 32 or 64 bit, is that ok?
  • Previous by thread: PackageMaker not honoring sub-package postinstall script
  • Index(es):
    • Date
    • Thread