Learn about Compiling

compilingMatt Godbolt has created an intriguing webpage letting you enter C++ code and then watch the resulting assembly code. You can try it right here.

The compilers supported are gcc, lcc and clang in various versions. Hardware target architectures are ARM, ARM64, AVR, PowerPC and x86. Not all combinations of compilers and architectures are available, but this is enough to spend some time experimenting.

You can also enter compiler optimizations. This lets you discover how intelligent modern compilers are. It is nice to see how complex you can go and still get a pre-calculated constant back.

The code for the whole setup is available on github, and other languages than C++ can be explored. For instance, here is a version for go.

This entry was posted in Programming. Bookmark the permalink.