• 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: No warning on float to int assignment?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: No warning on float to int assignment?


  • Subject: Re: No warning on float to int assignment?
  • From: Jason Coco <email@hidden>
  • Date: Fri, 24 Oct 2008 14:22:43 -0400


On Oct 24, 2008, at 14:10 , Don Arnel wrote:

I was just looking through some code that I wrote, and noticed I had changed a float to an int in my header file but I was still assigning float values to it in the code. The odd thing was that the compiler was not complaining about it. Which warning is it that I need to turn on in the compiler settings? I've looked through all the warning options but can't seem to find it. I'm using Xcode 3.1.1, GCC 4.0.

It's perfectly legal to cast a float to an integer... the integral portion is always maintained and the remainder is simply truncated. I can't really think of a reason to warn about this, which is probably why no such warning exists.


J

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: No warning on float to int assignment?
      • From: Chris Williams <email@hidden>
    • Re: No warning on float to int assignment?
      • From: Scott Ribe <email@hidden>
    • Re: No warning on float to int assignment?
      • From: "Sean McBride" <email@hidden>
References: 
 >No warning on float to int assignment? (From: Don Arnel <email@hidden>)

  • Prev by Date: No warning on float to int assignment?
  • Next by Date: Re: No warning on float to int assignment?
  • Previous by thread: No warning on float to int assignment?
  • Next by thread: Re: No warning on float to int assignment?
  • Index(es):
    • Date
    • Thread