Re: Spurious warnings
Re: Spurious warnings
- Subject: Re: Spurious warnings
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 22 Jul 2008 12:01:38 +0200
Le 22 juil. 08 à 10:41, Matt Gough a écrit : On 22 Jul 2008, at 10:24am, Jean-Daniel Dupas wrote:
On Jul 22, 2008, at 6:57 AM, Jens Alfke wrote:
Maybe you should post an example of code that produces the warning.
This is a nice one:
HIRect shapeBounds;
drawRect = CGRectMake( 0.0f, 0.0f, shapeBounds.size.width, shapeBounds.size.height );
warning: passing argument 1 of 'CGRectMake' as 'float' rather than 'double' due to prototype
warning: passing argument 2 of 'CGRectMake' as 'float' rather than 'double' due to prototype
warning: passing argument 3 of 'CGRectMake' as 'float' rather than 'double' due to prototype
warning: passing argument 4 of 'CGRectMake' as 'float' rather than 'double' due to prototype
CGGeometry.h:
CG_INLINE CGRect CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat height);
CGBase.h:
typedef float CGFloat;
HIRect is also made of float fields.
Jan E.
As already said, that's expected.
This warning says that the argument is converted because of the prototype declaration.
If the arg type was not defined in the prototype (like in a variadic functions) , it will be a double an not a float.
But as the original subject of this thread says, this is surely a spurious warning, as he is passing floats into a function that takes floats and only uses the parameters as floats in the implementation. I could understand it if he was doing this with his parameters: drawRect = CGRectMake( 0.0, // Double -> float 1, // integer -> float shapeBounds.size.width * 2.0f, // Double temporary -> float shapeBounds.size.height + 0.5 // Ditto ); I haven't checked, but maybe the ABI wants floating point params to always be doubles and this warning is really telling you this? Matt
That's not a question of ABI. Read the warning reference. It explicitly stat that it warn about something that would happen, not something that really happen.
Warn if a prototype causes a type conversion that is different from what would happen to the same argument in the absence of a prototype. This includes conversions of fixed point to floating and vice versa, and conversions changing the width or signedness of a fixed point argument except when the same as the default promotion.
This warning was already discussed on this list (or an other one). And the last time we talk about it, we agree to say: "do not check this warning because it is completly irrelevant".
|
_______________________________________________
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