News for hackers. Stuff that matters.
Re:The Cost of a Closure in C by mananaysiempre on Thursday December 11, 2025 @08:49AM (#46231328)
I see exactly the same assembly from x86-64 GCC 15.2 with -O2 the first example in the article both as is and without `static`, which makes sense. The two do differ if you add -fPIC, as though you’re compiling a dynamic library, and do not add -fvisibility=hidden at the same time, but that’s because Linux dynamic linking is badly designed.
Re:The Cost of a Closure in C by Chabsff on Thursday December 11, 2025 @08:57AM (#46231415)
TU-level concepts (mostly) dissolve during the linking stage. You need to compile with -c to generate an object file in order to see the distinction.

Also, the difference manifests in the symbols table, not the assembly.

Re:The Cost of a Closure in C by mananaysiempre on Thursday December 11, 2025 @09:24AM (#46231756)
To clarify, I was talking about Compiler Explorer-cleaned disassembly, same as the comment I was replying to.