News for hackers. Stuff that matters.
Re:Clang is better than GCC by knorker on Sunday November 27, 2022 @08:05PM (#33768682)
I know a company that used to build all code with both GCC and clang in parallel on every build, and use binary output from GCC but error/warning messages from clang.
Re:Clang is better than GCC by yjftsjthsd-h on Sunday November 27, 2022 @08:31PM (#33768837)
Honestly if nothing else that sounds amazing from the perspective of maintaining portability. Allowing you to exploit the strengths of each compiler is also nice:)
Re:Clang is better than GCC by pizlonator on Sunday November 27, 2022 @08:24PM (#33768806)
I wonder if GCC still has a codegen edge over clang.

I know it used to. No idea if it’s still the case.

Re:Clang is better than GCC by aew4ytasghe5 on Sunday November 27, 2022 @09:06PM (#33769066)
For x86 in certain cases, I think gcc produces better code still. But x86_64 / aarch64 looks different, and there I would assume the gap between gcc/clang is not big.

Would be cool to hear more about this.

Re:Clang is better than GCC by sanxiyn on Monday November 28, 2022 @01:28AM (#33770390)
I think GCC had an edge up to 2020 or so, mainly thanks to its better inliner. I should check this again now LLVM's inliner rewrite landed.
Re:Clang is better than GCC by vbezhenar on Sunday November 27, 2022 @08:44PM (#33768917)
It is wise because this dichotomy won't last forever. GCC will slowly die (because corporations seems to hate GPL and LLVM is their child) and everyone will need to migrate to LLVM sooner or later.
Re:Clang is better than GCC by ndiddy on Sunday November 27, 2022 @08:57PM (#33769022)
Ironically, while LLVM lives on, Clang is slowly dying and is failing to compete with GCC. Clang's C++20 support lags behind GCC because both of its major corporate sponsors, Google and Apple, have seemingly moved on (after failing to get the ABI changed, Google went over to working on Carbon, and Apple doesn't care as long as the C++ support is good enough to compile LLVM and the C++14 subset required for Metal's shading language). All the other vendors who take advantage of Clang's permissive licensing seem unwilling to upstream improved C++ support.
Re:Clang is better than GCC by jeffbee on Sunday November 27, 2022 @10:29PM (#33769519)
That isn't quite what we did at Google but for many years we did use clang for humans and GCC for releases. It's a good compromise, IMHO.