TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Compiler Explorer

541 pointsby disadvantageover 2 years ago

26 comments

mattgodboltover 2 years ago
Wow - we&#x27;re on Hacker News again! Hello all, and thanks for the link and discussion! While we&#x27;re here, we recently made some stats public: <a href="https:&#x2F;&#x2F;stats.compiler-explorer.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;stats.compiler-explorer.com&#x2F;</a> (spot the Hacker News spike!)<p>General stuff: we&#x27;re always looking for help; everything&#x27;s open source on GH: <a href="https:&#x2F;&#x2F;github.com&#x2F;compiler-explorer&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;compiler-explorer&#x2F;</a> (the base project, our cloud setup, all our build scripts, etc). The most valuable way to help us is with issues and PRs, or hang out on our Discord (<a href="https:&#x2F;&#x2F;discord.gg&#x2F;zNNgyRKh" rel="nofollow">https:&#x2F;&#x2F;discord.gg&#x2F;zNNgyRKh</a>). Then spread the word, and last we welcome sponsors on GH (<a href="https:&#x2F;&#x2F;github.com&#x2F;sponsors&#x2F;mattgodbolt" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sponsors&#x2F;mattgodbolt</a>) or Patreon (<a href="https:&#x2F;&#x2F;www.patreon.com&#x2F;mattgodbolt" rel="nofollow">https:&#x2F;&#x2F;www.patreon.com&#x2F;mattgodbolt</a>).
评论 #33226565 未加载
评论 #33227202 未加载
评论 #33227716 未加载
b3moralesover 2 years ago
A small tip when visiting godbolt: you can use the name of the language you&#x27;re interested in as a subdomain, to get a page immediately set up for that language, rather than starting with the default C++. For example <a href="https:&#x2F;&#x2F;erlang.godbolt.org" rel="nofollow">https:&#x2F;&#x2F;erlang.godbolt.org</a> or <a href="https:&#x2F;&#x2F;rust.godbolt.org" rel="nofollow">https:&#x2F;&#x2F;rust.godbolt.org</a>
评论 #33226103 未加载
评论 #33225785 未加载
choegerover 2 years ago
When I was still programming in C++ that tool was <i>the</i> method to discuss compiler internals and language semantics with colleagues. Just setup a minimal example and share it with your colleagues. Impressive and sad at the same time. Impressive for obvious reasons. Sad, because the language is so confabulated that there is no easy concise way to talk about its semantics.
评论 #33225318 未加载
评论 #33224959 未加载
评论 #33228937 未加载
评论 #33225160 未加载
slavik81over 2 years ago
I&#x27;ve used Compiler Explorer for many years as a C++ developer. When I started working in HIP, I really missed having Compiler Explorer in my toolbox. I&#x27;ve been on leave for the past couple months and I took the opportunity to make some contributions outside my normal work. Consequentially, full support for compiling HIP to AMDGPU assembly was merged last week.<p>Here&#x27;s an example: <a href="https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;qjsErWzcs" rel="nofollow">https:&#x2F;&#x2F;godbolt.org&#x2F;z&#x2F;qjsErWzcs</a>
评论 #33226484 未加载
dorongrinsteinover 2 years ago
Thank you Matt Godbolt for creating such a wonderful tool. You&#x27;re as cool as they get!
评论 #33224948 未加载
photochemsynover 2 years ago
It&#x27;s great that you can now get RISC-V output. IMO RISC-V is the most pleasant way to learn assembly-level programming. For anyone interested here&#x27;s a nice resource:<p><a href="https:&#x2F;&#x2F;riscv-programming.org&#x2F;book.html" rel="nofollow">https:&#x2F;&#x2F;riscv-programming.org&#x2F;book.html</a>
评论 #33226892 未加载
dangover 2 years ago
Related:<p><i>Compiler Explorer</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=24066570" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=24066570</a> - Aug 2020 (48 comments)<p><i>Compiler Explorer</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18671993" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18671993</a> - Dec 2018 (44 comments)<p><i>RMSbolt – An implementation of the Godbolt compiler-explorer for Emacs</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18104167" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=18104167</a> - Sept 2018 (9 comments)<p><i>Compiler bug in MSVC?</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16142512" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=16142512</a> - Jan 2018 (2 comments)<p><i>C compiler undefined behavior: calls never-called function</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15147335" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=15147335</a> - Sept 2017 (83 comments)<p><i>GodBolt: Enter C, get Assembly</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13182726" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13182726</a> - Dec 2016 (151 comments)<p><i>Compiler Explorer – now with side-by-side compiler comparison</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12627295" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=12627295</a> - Oct 2016 (6 comments)<p><i>Compiler Explorer</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11671730" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=11671730</a> - May 2016 (38 comments)<p><i>Interactive C++ Assembly Explorer</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9861294" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9861294</a> - July 2015 (8 comments)<p><i>See What Your C Function Compiles To</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9808870" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=9808870</a> - June 2015 (2 comments)<p><i>C&#x2F;C++ Fiddle</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7593109" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7593109</a> - April 2014 (40 comments)<p><i>Interactively watch how your C++ gets compiled.</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4020814" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=4020814</a> - May 2012 (1 comment)
评论 #33226431 未加载
ChrisMarshallNYover 2 years ago
I&#x27;ve used Godbolt for years.<p>The story that I heard, was that he was arguing with someone about some compiler optimization, and created the site to prove a point.
评论 #33225470 未加载
sylwareover 2 years ago
WOW!<p>There is a noscript&#x2F; basic (x)html version AND it does handle the _canonical_ gcc aka the last C compilable gcc (4.7.4).<p>Many of the optimization tricks hidden deep into those massive and complex software will be yours now.
ufoover 2 years ago
I recently learned that it&#x27;s not too difficult to run Compiler Explorer locally on your machine. Clone it from github and run the appropriate makefile and npm commands. Recently I&#x27;ve been using it Compiler Explorer a lot like this. It&#x27;s easier to use your own header files and it&#x27;s nice to not have the extra latency of compiling remotely or worry that you&#x27;re using so many of their CPU cycles. The main downside is that if you run locally you can only test on the version of gcc and clang that you have installed, while on the website you can test other versions and also other CPU architectures.
5e92cb50239222bover 2 years ago
A decent interview with the creator in podcast form.<p><a href="https:&#x2F;&#x2F;cppcast.com&#x2F;matt-godbolt-compiler-explorer&#x2F;" rel="nofollow">https:&#x2F;&#x2F;cppcast.com&#x2F;matt-godbolt-compiler-explorer&#x2F;</a>
评论 #33227207 未加载
usefulcatover 2 years ago
Awesome tool. I do mostly c++ all day and I use this almost daily, and certainly weekly. I think it’s really improved my feel for what the compiler will do with different constructs.
xfgustaover 2 years ago
I&#x27;d like to share a command-line tool to interact with Compiler Explorer that I made: <a href="https:&#x2F;&#x2F;github.com&#x2F;xfgusta&#x2F;cexpl" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;xfgusta&#x2F;cexpl</a>. It&#x27;s written in Python and it&#x27;s available on PyPI.
elromulousover 2 years ago
Seriously asking, how is it even possible to submit this to hn at this point? When one submits a previously submitted link, doesn&#x27;t it just alias to the previous submission?
评论 #33227670 未加载
caramelcreamover 2 years ago
Compiler Explorer is such a wonderful tool. It made examining and comparing compiler outputs so much easier and now pretty much everyone interested in optimizations is using it.
boriover 2 years ago
I&#x27;m looking at the C maxArray example and see that the for loop:<p><pre><code> for (i = 0; i &lt; 65536; i++) </code></pre> gets compiled as<p><pre><code> .L2: add rax, 8 cmp rax, 524288 jne .L4 </code></pre> Is there any fundamental reason why the loop increments with 8 instead of 1? Or is this completely arbitrary? Thanks.
评论 #33230239 未加载
shortlivedover 2 years ago
I just discovered goldbolt aka compiler explorer via this excellent podcast episode: <a href="https:&#x2F;&#x2F;corecursive.com&#x2F;to-the-assembly&#x2F;" rel="nofollow">https:&#x2F;&#x2F;corecursive.com&#x2F;to-the-assembly&#x2F;</a>
TobyTheDog123over 2 years ago
First ran across this when looking into Carbon - it&#x27;s a very cool tool!
seabassover 2 years ago
Is there a trick to make the typescript compiler run? All the other examples seem fine out of the box. No matter what I write, the ts compilation fails.
评论 #33228113 未加载
at_compile_timeover 2 years ago
I was using CE earlier today to verify that rustc was optimizing the way I thought it would. It&#x27;s a great service!
motgilkover 2 years ago
It&#x27;s an excellent tool. Would be nice if it showed you the full linker output too, of the final binary.
评论 #33228126 未加载
RobotToasterover 2 years ago
It&#x27;s interesting to see what the different levels of compiler optimisation produce.
whatsakandrover 2 years ago
The addition of cppfront during Herb&#x27;s the talk was legendary.
mik09over 2 years ago
wow i first saw this on a small alternative reddit site. great to see it here and being this popular!
londontover 2 years ago
This is VERY cool. Congrats!
justshowpostover 2 years ago
Its better than the others but also very unprofessional as the other web stuff. It DOES link but its absolutely impossible to view generated map. People are just hyping about codegen related microoptimizations but don&#x27;t care about layout at all.<p>Very typical for today&#x27;s world where javascript coder counts as software engineer.
评论 #33228272 未加载