MSVC preprocessor

Workarounds and fixes to make the Visual Studio compiler happy.