Re: strange compiler warnings - can't get rid of them?
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