Move variable declaration to the top its block for MSVC compatibility.