<div dir="ltr"><div><div><div><div><div>Hello,<br><br></div>there's an error when reporting the warning with this C++ code:<br><br>#include <cstdlib><br>void f()<br>{<br> float x = abs(1.f);<br> (void)x;<br>
}<br><br></div>it
reports correctly that 'abs' is wrong, but it suggests to use 'fabsf'
instead. 'fabsf' is defined for C99 and C11, not in C++! Not only that:
it suggests to include <math.h>, a C-style include ...<br><br></div>I
thought the way to fix is just replacing it with 'fabs' and include
<cmath>, which appears on the code with the argument of 'abs'
replaced with '-1.', but someone in IRC said it would be better to
suggest 'std::abs'. What do you think?<br><br></div>As a bonus: if you
replace 'abs' with 'fabs', it reports an error, but that would be
interesting to suggest including <cmath> or provide a
declaration for 'fabs'.<br><br></div><div>With regards,<br></div>Edward-san<br></div>