Rounding
ABX
abx at abx.art.pl
Tue Jul 4 00:29:02 PDT 2006
Hi all!
At tinderbox there is error:
http://signwriting.sourceforge.net/wxLogs/?log=logs.cf/HEAD-wxGTK-i386-pc-solaris2.9.err&id=6-3-18-40
wx/src/gtk/slider.cpp:137: error: `round' undeclared (first use this function)
This slider.cpp file contains at the top:
#ifdef __VMS
//Missing definition in OpenVMS C++ header files.
double round(double __x);
#endif
which means there is already one platform with round problem and tinderbox is
the other. In gtk1/slider.cpp file however there is:
static inline int AdjustValueToInt(double x)
{
// we want to round to the nearest integer, i.e. 0.9 is rounded to 1 and
// -0.9 is rounded to -1
return (int)(x < 0 ? x - 0.5 : x + 0.5);
}
and in motif/gauge.cpp there is:
#define round(x) ( (x) > 0 ? ((x) + 0.5) : -(-(x) + 0.5) )
This variety made me thing that it would be better to centralize this as
int wxRound(double);
function which hides all the portability problems. Anybody against?
ABX
More information about the wx-dev
mailing list