← Back to team overview

kicad-developers team mailing list archive

Re: Interesting compiler warning

 

That's what I thought. Okay - I'm putting together a few patches for a 
few "interesting" warnings, I'll include this. (I'll keep the patches 
separate this time so you can easily disregard ones you don't agree 
with.)

On Fri, Jun 26, 2015 at 03:25:18PM +0200, jp charras wrote:
> Le 26/06/2015 15:19, Chris Pavlina a écrit :
> > Hi,
> > 
> > clang gives this warning a couple times:
> > 
> > [ 45%] Building CXX object polygon/CMakeFiles/polygon.dir/math_for_graphics.cpp.o
> > /home/cmp/git/kicad/polygon/math_for_graphics.cpp:71:39: warning: using integer absolute value function 'abs' when argument is of floating point type [-Wabsolute-value]
> >                     *dist = std::min( abs( a - xi ), abs( a - xf ) );
> >                                       ^
> > /home/cmp/git/kicad/polygon/math_for_graphics.cpp:71:39: note: use function 'std::abs' instead
> >                     *dist = std::min( abs( a - xi ), abs( a - xf ) );
> >                                       ^~~
> >                                       std::abs
> > 
> > Can someone familiar with that section have a look and see if that is 
> > indeed the desired behavior? I'm thinking this will cause some rounding 
> > errors in potentionally subtle places.
> > 
> > --
> > Chris
> 
> 
> should be std::abs.
> 
> Generally speaking, only std::min, std::max std::abs should be used in
> Kicad code.
> 
> 
> -- 
> Jean-Pierre CHARRAS
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


References