• 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: How to snuff warnings on float/int conversion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to snuff warnings on float/int conversion


  • Subject: Re: How to snuff warnings on float/int conversion
  • From: Richard Schreyer <email@hidden>
  • Date: Tue, 2 Jan 2007 12:15:35 -0800

On Jan 2, 2007, at 11:53 AM, Ken Brooks wrote:

The following code fragment:

struct Pipe {
   int x, y, z;
        P3 at;  // P3 is a small struct of 3 floats
     <other fields>
};


void Pipe::vmove(const V3 &delta) { at += worldmove; x = roundf(at.x); y = roundf(at.y); z = roundf(at.z); }

Gets warnings like this on the lines like x = roundf(at.x); :

/Users/ken/Programs/comp236/Catchwater/Pipeworks/Catchwater.cpp: 731: warning: converting to 'int' from 'float'
I don't want such warnings; I'm perfectly happy with implicit truncation of floats. But I've read up and down the GCC manual's warnings list and can't find where to turn them off. -Wno- conversion doesn't get it, that only deals with function prototypes. Anybody know how to do it?


Using gcc 4.0, XCode 2.0.

You can entirely avoid using the implicit conversion by using lroundf () instead, which returns an int.


Richard


_______________________________________________ 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: 
 >How to snuff warnings on float/int conversion (From: Ken Brooks <email@hidden>)

  • Prev by Date: How to snuff warnings on float/int conversion
  • Next by Date: Re: ld -syslibroot reliability
  • Previous by thread: How to snuff warnings on float/int conversion
  • Next by thread: Re: Help...Debugger won't stop at breakpoints
  • Index(es):
    • Date
    • Thread