• 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: "Clark Cox" <email@hidden>
  • Date: Tue, 27 Nov 2007 10:11:26 -0800

On Nov 27, 2007 10:03 AM, Jens Miltner <email@hidden> wrote:
> 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.

It is implicitly converted to double. *then* it is converted to float
(which is what the function wants). It's this second conversion that
is different from K&R C, and is what -Wconversion is warning you
about. Even if you cast it to float yourself, the behavior is still
different from K&R C, and you will still be warned about it.

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

It looks to me like disabling the warning is your best option, as the
issue it is warning you about is largely irrelevant to you.

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

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>)
 >Re: strange compiler warnings - can't get rid of them? (From: Jens Miltner <email@hidden>)

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