From acd1e848dd4f7d0f375228f2f6dde002ce736ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 28 Aug 2020 19:42:52 +0200 Subject: [PATCH] manual; try to clarify better how variable contracts are used by cppcheck --- man/manual.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/man/manual.md b/man/manual.md index 1a950a353..12475b4d3 100644 --- a/man/manual.md +++ b/man/manual.md @@ -995,6 +995,13 @@ Here is an example code: The bug hunting analysis will warn about a division by zero. It can't be proven that x can't be 0. +A variable contract specify the allowed values for a variable. Cppcheck use variable +contracts both when a variable is read and written: +- When a variable is read, Cppcheck will assume that the contract is met. This +means you can avoid false positives for impossible variable values. +- When a variable is written, Cppcheck will ensure that its contract is not +violated. If it can't be determined that the contract is met you will get a +warning. #### Annotation