News for hackers. Stuff that matters.
Re:How it works: Compiler Explorer by qalmakka on Saturday February 03, 2018 @04:03AM (#16296870)
Tip: you can get Compiler Explorer to output ASM for almost every triple in existence (with varying results) by relying on the -target option of Clang. i.e., if you specify -target x86_64-w64-mingw32-gnu you can get ASM for windows (remember that the includes are still linux ones!), or if you specify -target x86_64-unknown-freebsd11.1 you can get asm for FreeBSD 11.1.
Re:How it works: Compiler Explorer by manaskarekar on Saturday February 03, 2018 @07:15AM (#16297330)
Matt Godbolt's cppcast appearances have been awesome.

He talks about Compiler Explorer[1] in one and Spectre/Meltdown[2] in another.

[1] http://cppcast.com/2016/01/matt-godbolt/

[2] http://cppcast.com/2018/01/matt-godbolt/

Re:How it works: Compiler Explorer by ziotom78 on Saturday February 03, 2018 @07:46AM (#16297406)
Thank you for creating this nice tool! I am teaching a C++ class, and sometimes I connect to Compiler Explorer in real time to explain how things are translated into low-level operations. I found this approach eye-opening for students, as it removes some of the «magical» aura modern compilers have in the eyes of the class.
Re:How it works: Compiler Explorer by sannee on Saturday February 03, 2018 @08:23AM (#16297513)
> it removes some of the «magical» aura modern compilers have in the eyes of the class.

Reading compiler output after adding -O3 seems to add magical aura in my case :)

Re:How it works: Compiler Explorer by ziotom78 on Saturday February 03, 2018 @10:09AM (#16297884)
Agreed! :-) However, making students see how complex constructs translate into a sequence of simple assembler operations helps a lot in understanding what compilers are all about.
Re:How it works: Compiler Explorer by besselheim on Saturday February 03, 2018 @08:31AM (#16297537)
I've found Compiler Explorer to be very useful indeed, for two main use cases: gaining insight into how security mitigations are implemented in different compilers, and for quickly checking my working when reverse engineering tricky C++ compiled code.

Really interesting to see how the tool works behind the scenes.

Re:How it works: Compiler Explorer by dhotson on Saturday February 03, 2018 @06:02AM (#16297142)
Thank you for making Compiler Explorer!

I was teaching some workmates a few things about how assembly programming works by looking at compiler output and this was a huge help. :)

Re:How it works: Compiler Explorer by mattgodbolt on Saturday February 03, 2018 @03:49PM (#16299556)
Thanks ms for your kind words!
Re:How it works: Compiler Explorer by ratherbefuddled on Saturday February 03, 2018 @03:24PM (#16299428)
Total aside but I recognised that domain because I used to play the MUD the author hosted ~20 years ago. Odd co-incidence.
Re:How it works: Compiler Explorer by mattgodbolt on Saturday February 03, 2018 @03:49PM (#16299553)
Oh wow! Hello from TheMoog hahah. Small world, eh?
Re:How it works: Compiler Explorer by ratherbefuddled on Saturday February 10, 2018 @05:22AM (#16346709)
It is! For about 6 months in 1999 I had one terminal running telnet to Xania and the other writing code in some bespoke procedual language on HP-UX. One got significantly more use than the other.
Re:How it works: Compiler Explorer by SkittlesNTwix on Saturday February 03, 2018 @04:05PM (#16299641)
This is remarkable - I've never heard of Compiler Explorer before now. I wish we had something like this back in university! Thank you so much for making this incredible tool.
Re:How it works: Compiler Explorer by spatulon on Saturday February 03, 2018 @10:45AM (#16298019)
I notice that MSVC is one of the supported compilers. Is he running a Windows VM as well, or did he manage to get the compiler to run under Wine?
Re:How it works: Compiler Explorer by raptorfactor on Saturday February 03, 2018 @12:57PM (#16298620)
It's running under Wine.
Re:How it works: Compiler Explorer by fulafel on Saturday February 03, 2018 @06:16AM (#16297174)
I think this view of Docker is pretty common: poor man's virtualization. You'd prefer real VMs but you can't reliably & performantly run nested VMs on public providers. Or can you? What's the current status on AWS/GCP/DigitalOcean/Hetzner?
Re:How it works: Compiler Explorer by chubot on Saturday February 03, 2018 @12:40PM (#16298552)
(tangent here)

I didn't get that from the article. He said that the tooling around Docker is clunky:

But I’ve always felt a bit like the Dockerfile you write is hard to maintain. I have to use some Makefile trickery to prevent having to repeat parts of the Dockerfile amongst each of the containers.

I don't like Docker either, but it's not because I want VMs. I want VMs even less than I want Docker! I want containers that are fast and light.

Basically I want to solve the problems of reproducibility/stability/portability with as little code as possible. VMs a bad way to do that because they involve not just a new user space like Docker, but a new kernel and hypervisor too!

Re:How it works: Compiler Explorer by mrkgnao on Saturday February 03, 2018 @06:18AM (#16297182)
Fun fact: the Vim plugin for my browser gave me the link hint "SSE" for the "<n> comments" link on the front page.
Re:How it works: Compiler Explorer by dingo_bat on Saturday February 03, 2018 @08:17AM (#16297489)
Godbolt's videos about the CPU are very eye-opening too: https://www.youtube.com/user/mattatgodboltorg/videos
Re:How it works: Compiler Explorer by amelius on Saturday February 03, 2018 @06:09AM (#16297155)
That sounds like a lot of work. My armchair-engineer instinct suspects it would be a lot simpler or at least cheaper to run everything in the browser (Emscripten/WASM), and serve static pages from a single node.
Re:How it works: Compiler Explorer by mattgodbolt on Saturday February 03, 2018 @03:51PM (#16299569)
Given how much effort it is to compile and maintain 200 different compilers just for Ubuntu (not to mention some closed-source compilers), this probably is not as simple as you'd think :-)
Re:How it works: Compiler Explorer by McP on Saturday February 03, 2018 @06:27AM (#16297205)
Are you suggesting running the compilers in the browser?
Re:How it works: Compiler Explorer by nerpderp83 on Saturday February 03, 2018 @10:11AM (#16297895)
But not bare-metal browser (BmB), on Linux of course.

https://bellard.org/jslinux/

Re:How it works: Compiler Explorer by dave84 on Saturday February 03, 2018 @07:37AM (#16297375)
So, transpile 8GB of compiler binaries to JavaScript which will inflate it to ~80GB. Now it’s a bandwidth problem.
Re:How it works: Compiler Explorer by amelius on Saturday February 03, 2018 @01:05PM (#16298661)
That is highly exaggerated. Most Linux distributions don't even have such size.

Also, most users don't need support for all languages.

Re:How it works: Compiler Explorer by dave84 on Sunday February 04, 2018 @07:20AM (#16302458)
> highly exaggerated

The article says 8GB of compiler binaries, asm.js in my experience is 10x the size of the original binary.

Obviously not everyone needs to download every compiler but even spreading that number between a few hundered compilers means 200+ mb JavaScript downloads.

Am I wrong?