[CLN-list] [cppcheck] Member variable 'gcd_result::gcd_degree' is not initialised in the constructor.

Bruno Haible bruno at clisp.org
Sun Jan 23 11:55:26 CET 2011


Hi,

Martin Ettl wrote:
> during a check with the static code analysis tool cppcheck of the current
> git head of cln, the tool discoverd a not initialized member variable of
> class gcd_result::gcd_degree.
> 
> Please refer the attached patch that fixes the issue.

Thanks for running the cppcheck tool on CLN. But in this case, the report
is a false positive: The only uses of the type gcd_result are in the same
file, function cantor_zassenhaus_sqrt, and you can see in lines 154, 161,
168, that the 'gcd_degree' member is only used when the 'condition' member
is NULL, and furthermore from function gcd you can see that when said
constructor is used the 'condition' member is assigned a non-NULL value.

So, the program is correct as is.

Bruno


More information about the CLN-list mailing list