diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index a33c79c..50b85e4 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -3194,6 +3194,8 @@ better **See also**: [Support library](#S-gsl) +**See also**: [Do not pass an array as a single pointer](#Ri-array) + ##### Enforcement * (Simple) ((Bounds)) Warn for any arithmetic operation on an expression of pointer type that results in a value of pointer type. @@ -17564,7 +17566,7 @@ Assume that `Apple` and `Pear` are two kinds of `Fruit`s. void maul(Fruit* p) { *p = Pear{}; // put a Pear into *p - p[1] = Pear{}; // put a Pear into p[2] + p[1] = Pear{}; // put a Pear into p[1] } Apple aa [] = { an_apple, another_apple }; // aa contains Apples (obviously!) @@ -17578,7 +17580,7 @@ If `sizeof(Apple) != sizeof(Pear)` the access to `aa[1]` will not be aligned to We have a type violation and possibly (probably) a memory corruption. Never write such code. -Note that `maul()` violates the a `T*` points to an individual object [Rule](#???). +Note that `maul()` violates the a [`T*` points to an individual object rule](#Rf-ptr). **Alternative**: Use a proper (templatized) container: @@ -17594,7 +17596,7 @@ Note that `maul()` violates the a `T*` points to an individual object [Rule](#?? Apple& a0 = &va[0]; // a Pear? -Note that the assignment in `maul2()` violated the no-slicing [Rule](#???). +Note that the assignment in `maul2()` violated the [no-slicing rule](#Res-slice). ##### Enforcement