From 4c27c1305c5e042ae1f62f6dc6ba7e96fd06e05d Mon Sep 17 00:00:00 2001 From: Dora <45337750+ddorab@users.noreply.github.com> Date: Mon, 13 May 2024 13:48:20 +0200 Subject: [PATCH] =?UTF-8?q?suppress:=20void*=20memset(void*,=20int,=20size?= =?UTF-8?q?=5Ft)=E2=80=99=20clearing=20an=20object=20of=20type=20=E2=80=98?= =?UTF-8?q?class=20CThreadSpinRWLock=E2=80=99=20with=20no=20trivial=20copy?= =?UTF-8?q?-assignment;=20use=20value-initialization=20instead=20(#212)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/tier0/threadtools.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/tier0/threadtools.h b/public/tier0/threadtools.h index a8bf595b..d15d2715 100644 --- a/public/tier0/threadtools.h +++ b/public/tier0/threadtools.h @@ -1127,7 +1127,12 @@ private: class ALIGN8 PLATFORM_CLASS CThreadSpinRWLock { public: - CThreadSpinRWLock() { COMPILE_TIME_ASSERT( sizeof( LockInfo_t ) == sizeof( int64 ) ); Assert( (intp)this % 8 == 0 ); memset( this, 0, sizeof( *this ) ); } + + CThreadSpinRWLock() : m_lockInfo{ 0, 0 } + { + COMPILE_TIME_ASSERT(sizeof(LockInfo_t) == sizeof(int64)); + Assert((intp)this % 8 == 0); + } bool TryLockForWrite(); bool TryLockForRead();