Skip to content

Commit 3bf7d6c

Browse files
author
thk123
committed
Update the invariant.cpp documentation to match
1 parent 655f220 commit 3bf7d6c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/util/invariant.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ Author: Martin Brain, [email protected]
2222
** evaluate to a boolean.
2323
**
2424
** As well as the condition they have a text argument that should be
25-
** used to say why they are true. The reason should be a string literals.
25+
** used to say why they are true. The reason should be a string literals
26+
** starting with a lower case character.
2627
** Longer diagnostics should be output to error(). For example:
2728
**
28-
** INVARIANT(x > 0, "x negative and zero case handled by other branches");
29+
** INVARIANT(
30+
** x > 0,
31+
** "x should have a positive value as others are handled by other branches");
32+
**
33+
** Use "should" style statements for messages in invariants (e.g. "array
34+
** should have a non-zero size") to make both the violation and the
35+
** expected behavior clear. (As opposed to "no zero size arrays" where it
36+
** isn't clear if the zero-size array is the problem, or the lack of it).
2937
**
3038
** To help classify different kinds of invariants, various short-hand
3139
** macros are provided.

0 commit comments

Comments
 (0)