/* 36 */ sort(array,5);
/* 37 */ }
В этой версии есть проблема в строке 20, где вместо предполагаемого оператора && применяется оператор &. Далее приведен отредактированный пример вывода splint, выполненной с этой версией программы. Обратите внимание на то, как она обнаруживает проблемы в строке 20 — тот факт, что вы не инициализировали переменную s и что возможны проблемы с условием из-за некорректного оператора.
neil@susel03:~/BLP4e/chapter10> splint -strict debug0.c
Splint 3.1.1 --- 19 Mar 2005
debug0.c:7:18: Read-only string literal storage used as initial value for
unqualified storage: array[0].data = "bill"
A read-only string literal is assigned to a non-observer reference. (Use -readonlytrans to inhibit warning)
debug0.c:8:18: Read-only string literal storage used as initial value for
unqualified storage: array[1].data = "neil"
debug0.c:9:18: Read-only string literal storage used as initial value for
unqualified storage: array[2].data = "john"
debug0.с:10:18: Read-only string literal storage used as initial value for
unqualified storage: array[3].data = "rick"
debug0.c:11:18: Read-only string literal storage used as initial value for
unqualified storage: array[4].data = "alex"
debug0.с:14:22: Old style function declaration
Function definition is in old style syntax. Standard prototype syntax is
preferred. (Use -oldstyle to inhibit warning)
debug0.с: (in function sort)
debug0.с:20:23: Left operand of & is not unsigned value (boolean):
i < n & s != 0
An operand to a bitwise operator is not an unsigned values. This may have
unexpected results depending on the signed representations. (Use
-bitwisesigned to inhibit warning).