Matt Godbolt has announced today that the Visual C++ compiler is finally available on Compiler Explorer (https://godbolt.org/). Compiler Explorer is a website where you can write C/C++/Rust/Go/D code, compile it with various compilers and settings and see the resulted assembly code.
#CompilerExplorer now has VS 2017 compilers! Huge thanks to @Microsoft and @apardoe!
— Matt Godbolt (@mattgodbolt) March 19, 2017
The version available is 1910, i.e. VC++ 2017 RTM (the exact version number is 19.10.25017.0). The following targets are available:
- x86: x86 CL 19 2017 RTW
- x64: x86-64 CL 19 2017 RTW
- ARM: ARM CL 19 2017 RTW
To give it a try, I compiled the following program:
#include <iostream> int main() { std::cout << "hello world" << std::endl; return 0; }
The result may look at little bit surprizing, as it totals over 5000 lines of assembly code, as oposed to gcc 7 or clang 4 that only produce 42.
5000 lines of disassembly had made me turn away from looking at disassembly in the first place. I’ve been looking at disassembly more recently as Godbolt’s usage on C++ posts keeps rising. For VC++, some posts, mini-video series showing way through lengthy outcomes is most welcome.
As a note, Clang and GCC tend to be more aggressive about optimising than MSVC by default, at least in my experience.