From 016e14c460e4a0ee928dc3547be787caa2191197 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 5 Sep 2019 01:12:05 -0400 Subject: [PATCH] MemoryWriter: Initialize member variables to deterministic values Makes the variable initialization behavior deterministic in the case of the default constructor. This also eliminates the possibility of an uninitialized read from occurring within the destructor entirely; even in the face of future changes. --- include/athena/MemoryWriter.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/athena/MemoryWriter.hpp b/include/athena/MemoryWriter.hpp index c9306d0..c3e87da 100644 --- a/include/athena/MemoryWriter.hpp +++ b/include/athena/MemoryWriter.hpp @@ -90,11 +90,11 @@ public: void writeUBytes(const atUint8* data, atUint64 length) override; protected: - MemoryWriter() {} - atUint8* m_data; - atUint64 m_length; - atUint64 m_position; - bool m_bufferOwned; + MemoryWriter() = default; + atUint8* m_data = nullptr; + atUint64 m_length = 0; + atUint64 m_position = 0; + bool m_bufferOwned = false; std::string m_filepath; //!< Path to the target file };