// scanf and printf are just to get rid of unused and uninitialized variableintmain(){uint32_ta;scanf("%u",&a);uint32_ti=a,j=a;uint64_tk=i*j;printf("%lu",k);}
When running cppcheck --enable=style I have error:
That seems to be a true positive. The multiplication is done using 32 bits, and the result is assigned to a 64 bit value. In case of a = 5, cppcheck knows that no overflow can occur.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using cppcheck 2.18.0
Here is code:
When running
cppcheck --enable=styleI have error:There's no issue when I remove the
scanfand assign some number to theavariable e.g.uint32_t a = 5;That seems to be a true positive. The multiplication is done using 32 bits, and the result is assigned to a 64 bit value. In case of
a = 5, cppcheck knows that no overflow can occur.