Skip to content

Commit 292fc15

Browse files
committed
copyedit: Move a comment for consistency, change "a" to "the", and fix a typo: "f" to "f2"
This is a merge commit to bundle trivial changes: * [This Commit] |\ | * trivial: s/a/the/ | * trivial: Move a code comment (//...) to the line above the code | * trivial: s/f/f2/ |/ * 2722375
2 parents 2722375 + abb5af8 commit 292fc15

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

CppCoreGuidelines.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,8 @@ We can of course pass the number of elements along with the pointer:
767767

768768
void g2(int n)
769769
{
770-
f2(new int[n], n); // bad: a wrong number of elements can be passed to f()
770+
// bad: the wrong number of elements can be passed to f2()
771+
f2(new int[n], n);
771772
}
772773

773774
Passing the number of elements as an argument is better (and far more common) than just passing the pointer and relying on some (unstated) convention for knowing or discovering the number of elements. However (as shown), a simple typo can introduce a serious error. The connection between the two arguments of `f2()` is conventional, rather than explicit.

0 commit comments

Comments
 (0)