From 46e867e9c6f387d5ea1b40bdd833cb8df57ddf72 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Mon, 28 Sep 2015 09:54:11 -0700 Subject: [PATCH] Improve wording and structure of paragraph. To be grammatically correct, the phrase "Confusion about what meaning a T* is the source" should have had a doubled "is", which would have been awkward, so the sentence has been reworded. The second and third sentences were inverted. Prior to the inversion, the sentence starting with "For example" initially appeared to be expanding on the debuggability of not_null, rather than providing an example of how using separate names improves code quality. --- CppCoreGuidelines.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index fb94419..4050adf 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -1953,9 +1953,10 @@ such as passing a `const int&`, returning an `array` by value, and retur * Identify an array with a length specified separately * Identify a location in an array -Confusion about what meaning a `T*` is the source of many serious errors, so using separate names for pointers of these separate uses makes code clearer. -For debugging, `owner` and `not_null` can be instrumented to check. +Using separate names for each of these uses improves code quality because confusion about the meaning of any particular `T*` is the source of many serious errors. For example, `not_null` makes it obvious to a reader (human or machine) that a test for `nullptr` is not necessary before dereference. +Additionally, when debugging, `owner` and `not_null` can be instrumented to check for correctness. + **Example**: Consider