News for hackers. Stuff that matters.
Re:GCC 8.2 Released by tbrock on Thursday July 26, 2018 @09:39AM (#17617370)
As someone who used to write c++ these are the reasons clang was great for development:

  - compiles faster
  - better error messages
  - tooling (clangformat) is great
When it came time to cut a release binary you could always also build with gcc
Re:GCC 8.2 Released by ebikelaw on Thursday July 26, 2018 @10:07AM (#17617621)
This is what I do. I use clang for everything except the final release. I get clang's speed and superior error messages while I'm editing code, and I get the very slightly, but measurably faster code generated by GCC.
Re:GCC 8.2 Released by HelloNurse on Thursday July 26, 2018 @10:23AM (#17617739)
I've always used gcc on all platforms for C and C++, but since last year I also use clangformat.

On the other hand, the effort of learning clang options, error messages and paths in order to have two compilers available can wait indefinitely until I really need a second opinion about some compilation error; so far it hasn't happened.

Re:GCC 8.2 Released by ebikelaw on Thursday July 26, 2018 @11:01AM (#17617986)
You could build with bazel, which ships compiler configs for clang and gcc on linux (among other combinations) in its "CROSSTOOL"[1] file. Then it's trivial to switch compilers with one argument. This feature is a result of Google's years-long support of both GCC and clang for its own build, test, and release.

  $ bazel build --compiler=my_favorite_compiler //my/fine:program
1: https://github.com/bazelbuild/bazel/wiki/Building-with-a-cus...
Re:GCC 8.2 Released by HelloNurse on Thursday July 26, 2018 @12:08PM (#17618535)
Sorry, I lost you at "bazel". Do you believe constructing clang command lines in addition to gcc command lines is harder than setting up a particularly complex build tool like Bazel? Not to mention that it doesn't appear to support GCC and Clang on Windows.
Re:GCC 8.2 Released by ebikelaw on Thursday July 26, 2018 @12:15PM (#17618596)
Bazel comes with an installer package that you click and run. I didn't find it that complicated. It comes out of the box with CROSSTOOL support for GCC, clang, and MSVC on Windows, among dozens of other toolchains.

https://github.com/bazelbuild/bazel/blob/master/tools/cpp/CR...

Re:GCC 8.2 Released by HelloNurse on Thursday July 26, 2018 @12:58PM (#17618937)
The official documentation at https://docs.bazel.build/versions/master/windows.html says:

Build C++

To build C++ targets, you need:

•The Visual C++ compiler.

Whether the developers gave up on the Mingw64 GCC and Clang toolchains or it's a documentation mistake, this statement places Bazel support for Windows in the "don't touch with a 10' pole" category.

But my point was that adopting Bazel is obviously far more complex than adapting existing build scripts and build script generators for Make, Cmake, Ninja etc to use Clang.

Re:GCC 8.2 Released by earenndil on Thursday July 26, 2018 @02:20PM (#17619623)
Options are mostly the same. You can easily switch out the two compilers in most build systems. Make: make CC=clang CXX=clang++. Cmake: cmake -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++. Autoconf: CC=clang CXX=clang++ ./configure.
Re:GCC 8.2 Released by collinf on Thursday July 26, 2018 @10:46AM (#17617887)
This seems like it would be a nightmare to deal with if things ever went wrong. Is this actually a viable option?
Re:GCC 8.2 Released by tbrock on Thursday July 26, 2018 @01:00PM (#17618957)
Just run CI + tests using the release compiler instead of the dev one. Not a big deal.

Also it’s trivial to change the dev compiler when debugging something that might be a compiler error (it never is though).

Re:GCC 8.2 Released by hhmc on Thursday July 26, 2018 @11:30AM (#17618220)
I had a similar workflow, except icc for release, which still outperforms gcc on certain types of codebases.