On 10/24/08 2:22 PM, Jason Coco said:

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

Perfectly legal, but often unintended.  A reason to warn is that
information is lost.

CodeWarrior has 2 independent warnings for this: float to integer and
integer to float.  I've looked, but I don't think gcc has this.

--
____________________________________________________________
Sean McBride, B. Eng                 [EMAIL PROTECTED]
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to