Skip to content

Commit 43bfc73

Browse files
thk123danpoe
thk123
authored andcommitted
Update the invariant.h documentation to match CODING_STANDARD.md
1 parent 8b44641 commit 43bfc73

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/util/invariant.h

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

0 commit comments

Comments
 (0)