diff --git a/CppCoreGuidelines.md b/CppCoreGuidelines.md index 8020056..3b66251 100644 --- a/CppCoreGuidelines.md +++ b/CppCoreGuidelines.md @@ -1,6 +1,6 @@ # C++ Core Guidelines -December 26, 2017 +Janualy 1, 2018 Editors: @@ -18558,6 +18558,13 @@ For a variable-length array, use `std::vector`, which additionally can change it Use `gsl::span` for non-owning references into a container. +##### Note + +Comparing the performance of a fixed-sized array allocated on the stack against a `vector` with its elements on the free store is bogus. +You could just as well compare a `std::array` on the stack against the result of a `malloc()` accessed through a pointer. +For most code, even the difference between stack allocation and free-store allocation doesn't matter, but the convenieance and safety of `vector` does. +People working with code for which that difference matters are quite capable of choosing between `array` and `vector`. + ##### Enforcement * Flag declaration of a C array inside a function or class that also declares an STL container (to avoid excessive noisy warnings on legacy non-STL code). To fix: At least change the C array to a `std::array`.