diff --git a/CODING_STANDARD.md b/CODING_STANDARD.md index c218cdf859b8..ee5d189a632d 100644 --- a/CODING_STANDARD.md +++ b/CODING_STANDARD.md @@ -188,6 +188,10 @@ Formatting is enforced using clang-format. For more information about this, see - Avoid `assert`. If the condition is an actual invariant, use INVARIANT, PRECONDITION, POSTCONDITION, CHECK_RETURN, UNREACHABLE or DATA_INVARIANT. If there are possible reasons why it might fail, throw an exception. + - Use "should" style statements for messages in invariants (e.g. "Array + should have a non-zero size") to make it clear both the violation and the + expected behavior. (As opposed to "no zero size arrays" where it isn't + clear if the zero-size array is the problem, or the lack of it). - All raw pointers (such as those returned by `symbol_tablet::lookup`) are assumed to be non-owning, and should not be `delete`d. Raw pointers that point to heap-allocated memory should be private data members of an object