From 6ff6556a531e06217fe5e7ad86d2093b3c79ea7c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Sep 2022 19:36:15 -0400 Subject: Fix uninitialized members --- .clang-tidy | 1 - include/chilbert/BoundedBitVec.hpp | 2 +- include/chilbert/SmallBitVec.hpp | 3 +-- test/test_hilbert.cpp | 2 +- test/test_utils.hpp | 4 ++-- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index e096e94..d4f85ba 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,7 +2,6 @@ Checks: > *, -*-avoid-c-arrays, -*-magic-numbers, - -*-member-init, -*-move-const-arg, -*-named-parameter, -*-no-malloc, diff --git a/include/chilbert/BoundedBitVec.hpp b/include/chilbert/BoundedBitVec.hpp index fa414ca..4f9ef60 100644 --- a/include/chilbert/BoundedBitVec.hpp +++ b/include/chilbert/BoundedBitVec.hpp @@ -92,7 +92,7 @@ private: } std::array m_racks{}; - size_t m_size; + size_t m_size{}; }; namespace detail { diff --git a/include/chilbert/SmallBitVec.hpp b/include/chilbert/SmallBitVec.hpp index 10668ac..d9256c6 100644 --- a/include/chilbert/SmallBitVec.hpp +++ b/include/chilbert/SmallBitVec.hpp @@ -70,8 +70,7 @@ public: }; explicit SmallBitVec(const size_t bits) - : m_rack{0} - , m_size{bits} + : m_size{bits} { assert(bits <= bits_per_rack); } diff --git a/test/test_hilbert.cpp b/test/test_hilbert.cpp index ac4bba1..a0a64c0 100644 --- a/test/test_hilbert.cpp +++ b/test/test_hilbert.cpp @@ -39,7 +39,7 @@ template std::array make_random_point(Context& ctx, const std::array& ms) { - std::array p; + std::array p{}; for (size_t i = 0; i < D; ++i) { p[i] = rand_between(ctx, 0, (1UL << ms[i]) - 1); } diff --git a/test/test_utils.hpp b/test/test_utils.hpp index 3388552..65bd1b1 100644 --- a/test/test_utils.hpp +++ b/test/test_utils.hpp @@ -69,7 +69,7 @@ template std::array make_random_precisions(Context& ctx) { - std::array ms; + std::array ms{}; size_t bits_left = N; for (size_t i = 0; i < D; ++i) { @@ -85,7 +85,7 @@ template std::array make_random_point(Context& ctx) { - std::array p; + std::array p{}; for (size_t i = 0; i < D; ++i) { p[i] = rand_between(ctx, 0, (1UL << M) - 1); } -- cgit v1.2.1