Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Code that is executed but does not perform any action, or has an unintended effect, most likely results from a coding error and can result in unexpected behavior. Statements or expressions that have no effect should be identified and removed from code. Most modern compilers can warn about code that has no effect in many cases. (see See guideline [MSC00-C. Compile cleanly at high warning levels.).

This recommendation is related to guideline MSC07-C. Detect and remove dead code.

...

If the intent was to increment the value referred to by p, then parentheses can be used to ensure p is dereferenced and then incremented. (see See guideline EXP00-C. Use parentheses for precedence of operation.).

Code Block
bgColor#ccccff
int *p;
/* ... */
(*p)++;

...

Bibliography

Wiki Markup
\[[Coverity 072007|AA. Bibliography#Coverity 07]\]

...