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: "Clark Cox" <email@hidden>
- Date: Tue, 27 Nov 2007 09:41:37 -0800
On Nov 27, 2007 9:39 AM, Jean-Daniel Dupas <email@hidden> wrote:
>
> >>
> >
> > The warning is correct (you asked for -Wconversion after all). The
> > type of the expression (iconSize.width * 0.75) is double, and you are
> > converting it to a float by passing it to NSMakeSize.
> >
> > -Wconversion largely exists to catch problems when going from K&R C
> > (where it was quite tricky to pass a 'float' argument) to ANSI/ISO C ,
> > and as such doesn't have much use in other situations.
> >
> > You can either turn off the warning or use this instead:
> > NSSize warningIconSize = {iconSize.width * 0.75, iconSize.height *
> > 0.75};
>
> You can also do NSSize iconSize = {iconSize.width * 0.75f,
> iconSize.height * 0.75f};
No need; the example I gave works in both 32-bit and 64-bit, with or
without the -Wconversion flag.
--
Clark S. Cox III
email@hidden
_______________________________________________
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