On 8 October 2015 at 01:26, Matteo Bruni mbruni@codeweavers.com wrote:
Clang on OS X complains about calling abs() on an unsigned value and I think it has a point since technically the unsigned to signed conversion is implementation-dependent when the value can't be represented in the signed integer type (i.e. for the "negative" numbers).
...and I don't suppose you accidentally compiled with -Wpedantic. The warning isn't wrong, but it's not terribly useful either. On two's complement systems (i.e., anything relevant) the reasonable thing to do is also the correct thing. This function exists in other places as well, of course.
2015-10-08 13:33 GMT+02:00 Henri Verbeet hverbeet@gmail.com:
On 8 October 2015 at 01:26, Matteo Bruni mbruni@codeweavers.com wrote:
Clang on OS X complains about calling abs() on an unsigned value and I think it has a point since technically the unsigned to signed conversion is implementation-dependent when the value can't be represented in the signed integer type (i.e. for the "negative" numbers).
...and I don't suppose you accidentally compiled with -Wpedantic. The warning isn't wrong, but it's not terribly useful either. On two's complement systems (i.e., anything relevant) the reasonable thing to do is also the correct thing. This function exists in other places as well, of course.
No, no -Wpedantic or other weird flags and yeah, it's not a very interesting warning. Actually the message is "warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value]", which is just wrong since removing the abs() obviously breaks the comparison.