I’m getting a warning while running static code analysis, as below:
This output parameter value is not subsequently checked.
And in the code I was using a variable which is non Bool. Can someone help me here?
>Solution :
Note code should be written to most clearly indicate the intent. So people start discovering some patterns and then introduced some coding standards.
One of such coding standard rule is:
- none const reference function argument is used to indicate output argument of the function.
So when static analysis tool sees your void foo(bool &ref) functions it assumes that calling foo changes variable. It is assumed that whole purpose of foo was to return value by argument.
So when tools sees that value was read, but is not used it assumes that this is a code smell. Value should be used to do something significant or invocation of foo should be removed.
Now if foo has some side effects and you do not care about this value then there are ways to inform tool (and other developer) that this value is not important. For example you can add (void)success. Anyway discarding error is one of thing which should be avoided, so if the problems is present it should be easy investigate root cause.
