From 99f210a0e7041b7aba1816cd0a0643a8eb762d6b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 16 Jul 2020 01:49:23 +0200 Subject: [PATCH] Avoid uninitialized variable warnings in debug MSVC build The compiler is smart enough to determine that the variables are always initialized when they're actually used when using optimizations, but gives a bunch of C4701 warnings for them if we don't initialize them in the non-optimized debug builds. --- src/common/dcgraph.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/common/dcgraph.cpp b/src/common/dcgraph.cpp index f519943100..5da2fe531d 100644 --- a/src/common/dcgraph.cpp +++ b/src/common/dcgraph.cpp @@ -1234,7 +1234,10 @@ void wxGCDCImpl::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord * m_graphicContext->SetFont( *theFont, m_textForegroundColour ); } - wxDouble h , d , e , w; + wxDouble w wxDUMMY_INITIALIZE(0), + h wxDUMMY_INITIALIZE(0), + d wxDUMMY_INITIALIZE(0), + e wxDUMMY_INITIALIZE(0); // Don't pass non-NULL pointers for the parts we don't need, this could // result in doing extra unnecessary work inside GetTextExtent().