resolve several compilation warnings

- Resolves several MSVC and GCC compiler warnings as noted in the commit descriptions.
- Enables compilation with `/W4` on MSVC and without `-Wno-sign-compare` on GCC.