Compiler Explorer's embedded view

Today I updated Compiler Explorer to support better sharing, specifically to allow embedding a Compiler Explorer view into another site, useful for blog posts that wish to demonstrate how compilers generate code, or how language constructs actually become assembly.

For example, maybe you want to show off how well the compiler optimizes multiplying by a constant:

Or perhaps you’d like to demonstrate how little overhead there is in using lambdas (as demonstrated in Jason Turner’s excellent C++ Weekly video):

To use the new functionality, click the “Share” icon and pick “Embed” from the dropdown.

The embed feature is limited to single-pane output: only a single editor and compiler are supported. The options you have selected at the time of making the link are hard-coded into the embed URL. If you have deselected “compile on type”, then the embedded link will be made non-editable (that is, the code in the embedded site will not be editable).

Filed under: Coding
Posted at 16:25:00 GMT on 2nd November 2016.

About Matt Godbolt

Matt Godbolt is a C++ developer working in Chicago for Aquatic. Follow him on Mastodon.