$ clang++ -g -O2 -Wall -c oct1a.cc
oct1a.cc:12:7: warning: implicit conversion from 'double' to 'int' changes value from 0.01 to 0 [-Wliteral-conversion]
i = 0.01;
~ ^~~~
oct1a.cc:14:8: warning: implicit conversion from 'double' to 'int' changes value from 0.02 to 0 [-Wliteral-conversion]
i = -0.02;
~ ^~~~
2 warnings generated.
$
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
define THIS 0.01
define THAT -0.02
extern void g(int);
void f(int p1)
{
int i;
}
$ clang++ -g -O2 -Wall -c oct1a.cc
oct1a.cc:12:7: warning: implicit conversion from 'double' to 'int' changes value from 0.01 to 0 [-Wliteral-conversion]
i = 0.01;
~ ^~~~
oct1a.cc:14:8: warning: implicit conversion from 'double' to 'int' changes value from 0.02 to 0 [-Wliteral-conversion]
i = -0.02;
~ ^~~~
2 warnings generated.
$
I don't think this is a good idea. If you want to truncate the value then you assign it. then there is noise.
as an addon or rule I can live with it.