• 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
Re: strange compiler warnings - can't get rid of them?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strange compiler warnings - can't get rid of them?


  • Subject: Re: strange compiler warnings - can't get rid of them?
  • From: Jens Miltner <email@hidden>
  • Date: Tue, 27 Nov 2007 19:03:02 +0100

OK guys, I'm ready to abandon the -Wconversion flag ;-)

On 27.11.2007, at 18:54, Clark Cox wrote:

Looks like the
float is implicitely propagated to double just to be propagated to
float again, which to me doesn't make sense ;-)

That is the way C is defined. All arithmetic expressions involving float or double are promoted to double, just as expressions involving int, char or short are promoted to int. (the actual rules are a bit more involved than that, but you get the gist).

Hmmh - I would be ok with everything being promoted to double (which is also what I expected), but in this case, no matter what I do (explicitely cast to float, explicitely cast to double), I get this warning, which absolutely doesn't make sense to me.
I don't want to beat a dead horse here, but a warning only makes sense to me if there's something I can do about it (other than disable the warning)...



On 27.11.2007, at 18:45, Stefan Haller wrote:

iconSize.width is a float, but 0.75 is a double; multiplying them yields
a double. The warning says that you are passing this double to a
function that takes a float, which loses precision.


To avoid the warning, use 0.75f instead of 0.75.

Nope, as I mentioned in my OP, explicitely casting to float doesn't help either...



On 27.11.2007, at 18:38, Jeff Johnson wrote:

My understanding is that -Wconversion warns you about differences between new-style function prototypes, i.e., NSSize NSMakeSize(float width, float height), and old-style function prototypes, i.e., NSSize NSMakeSize(). I think you'd actually get rid of the warning by casting the arguments as double rather than float, ironically.

Nope, won't help either :(




_______________________________________________ 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
  • Follow-Ups:
    • Re: strange compiler warnings - can't get rid of them?
      • From: "Clark Cox" <email@hidden>
References: 
 >strange compiler warnings - can't get rid of them? (From: Jens Miltner <email@hidden>)
 >Re: strange compiler warnings - can't get rid of them? (From: "Clark Cox" <email@hidden>)
 >Re: strange compiler warnings - can't get rid of them? (From: Jens Miltner <email@hidden>)
 >Re: strange compiler warnings - can't get rid of them? (From: "Clark Cox" <email@hidden>)

  • Prev by Date: Xcode 2.5 and the "fork: Resource temporarily unavailable" error message
  • Next by Date: Re: strange compiler warnings - can't get rid of them?
  • Previous by thread: Re: strange compiler warnings - can't get rid of them?
  • Next by thread: Re: strange compiler warnings - can't get rid of them?
  • Index(es):
    • Date
    • Thread