Check _MSC_VER for msvc specific code

Recent mingw versions define _M_{ARCH} macros for compatibility
and this caused selection of msvc-specific code on gcc.
Fix 'err' may be used uninitialized in this function