From fe99de20ff8f0594a17e2cedf680d25e86dd5a13 Mon Sep 17 00:00:00 2001 From: Marco Costalba Date: Thu, 5 Jan 2017 08:50:17 +0100 Subject: [PATCH] Correct zero-init of Thread data members If not explicitly initialized in a class constructor, then all data members are default-initialized when the corresponing struct/class is instanced. For array and built-in types (int, char, etc..) default-initialization is a no-op and we need to explicitly zero them. No functional change. --- src/movepick.h | 1 + src/thread.cpp | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/movepick.h b/src/movepick.h index 6fbd8be1..999ec966 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -41,6 +41,7 @@ struct Stats { static const Value Max = Value(1 << 28); + Stats() { clear(); } const T* operator[](Piece pc) const { return table[pc]; } T* operator[](Piece pc) { return table[pc]; } void clear() { std::memset(table, 0, sizeof(table)); } diff --git a/src/thread.cpp b/src/thread.cpp index 65e170a0..3c3de60d 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -37,8 +37,6 @@ Thread::Thread() { resetCalls = exit = false; maxPly = callsCnt = 0; tbHits = 0; - history.clear(); - counterMoves.clear(); idx = Threads.size(); // Start from 0 std::unique_lock lk(mutex); -- 2.39.2