Regular Visual Studio versus ClangCL
lemire.me
lemire.me
clangcl indeed caught a lot of problems, but not all. msvc still deviated more than with chrome. The clangcl/msvc wrong size reports were very good! Here are the additional MSVC fixes I had to add, over clangcl:
VS2019 specific fixes, __VA_ARGS__, __attribute__, suppress warnings
* __VA_ARGS__ macro support (illegal ...)
* __attribute__ only with __GCC__
* suppress C4101 uninitialized recount warnings, and strcpy
insecure warnings.
* no proper const var support
(with the even weirder error: cannot allocate an array of constant
size)
* much stricter typecasts (silly cl compiler)
* strict dllexport/dllimport decls: fix various omissions
clangcl is not error compatible to msvc, msvc errors much more.While I was there: tcc was fine, for chibicc I had to file some PR's with large files, and pcc is currently broken, some tricky cpp regressions, which I couldn't fix.
clangcl on WSL it would be much faster, but msvc natively would beat it, esp. if you turn off the virus scanner and inherited filesystem permissions. The sheer amount of additional msvc warnings (integer promotion should not really warn) would slow it down though.
[1] https://llvm.org/devmtg/2020-09/slides/CIL_Common_MLIR_Abstr...
GCC and clang have those same features, but they avoid including them in their main distribution and instead have experimental/development forks that people can use, opting to include them only when they meet a much higher standard than Microsoft.
Which is extremely frustrating when i reported a very similar issue in 17.4 which was reported as fixed (https://developercommunity.visualstudio.com/t/if-constexprre...), etc.
I try building my code every once in a while against MSVC because it has some useful warnings but am very burn out with code breaking on almost every minor version - I shifted all my serious work to clang+libc++ on windows a few years ago already. E.g. I've reported something like 50+ bugs, internal compiler errors, etc... to MS over the years and only a couple for clang even though I use it much much more.
I feel this is a red herring.
People use AppleClang because it ships with Xcode and is integrated with it. Those who are stuck with Xcode will not choose msvc's support for C++20 as a good enough reason to drop everything.
With Clang, the main differences with MSVC boil down to a couple of minor features that are hardly showstoppers, such as simplifying implicit lambda captures.
Between being able to use clang and all it's tooling and being stuck with msvc, using clang is far above in importance.
LLVM has an amazing optimizer but the compiler is just so much slower even on unoptimized builds.
Whilst not quite on topic, this is especially catastrophic for anything that uses fork() and friends via Cygwin. (i.e. the MSYS2 ecosystem and the MinGW64 compiler suite). MSYS2 native `git add -> [tab]` halts the freezes command line for a second and turning off Windows Defender or using folder exceptions easily cuts compilation time by for Makefiles with multiple small files 30%.
I believe there's two reasons for this:
* C: has extra IO filter drivers for system integrity that eat up CPU
* C:, by default, enables 8dot3names for compatibility (e.g. with software that expects C:\Progra~1\ to work as an alias to C:\Program Files\). On other partitions, 8dot3names are disabled by default.
So I recommend putting the OS on a separate partition from all development activities. Also, don't forget to exclude D: from Windows Defender.
Also who even knows what this build was doing as it used CMake(garbage). It isn't clear what compiler settings were enabled either since again CMake.
To me that means absolutely nothing, as visual studio and msbuild fails to support basic features like compiler launchers, which enable using compiler cache tools like ccache or sscache.
While you're benchmarking compilers, I plug ccache and build projects with dozen of subpackages in under a minute with build servers maxing out on IO.
clang doesn't come with a state of the art IDE, GUI frameworks, hot code reloading, among lots of other goodies.
Then again, maybe Microsoft should join the other C and C++ vendors that have forked clang and hardly contribute anything to upstream other than LLVM stuff, which is why clang is now enjoying a comfty third place in ISO conformance, after Apple and Google decided to re-focus on their own languages.
Is that MSVS you are talking about? I don't think even Microsoft's own marketing team would've been so bold as to actually say something like that...
Still better than contributing nothing.
> clang doesn't come with a state of the art IDE, GUI frameworks, hot code reloading, among lots of other goodies.
These features are compiler-agnostic and can be easily built on top of clangd, cling, etc.
No they cannot, clangd isn't compiler agnostic, and Clion's dependency on it is now being hindered by clang's slow pace, even if the goal is to target another compiler.
libc++ is indeed in a sorry state, but at least on linux clang is usually used against libstdc++ so it is not a huge deal. Personally I'm worried about clangd falling behind, but so far I see very very little that it doesn't understand.
What are you talking about? I use Clion just fine regardless of compiler.
> GUI frameworks, hot code reloading, among lots of other goodies.
Do you understand that those features have absolutely zero to do with compilers?
Then there are plenty of other ones following up clang.
https://en.cppreference.com/w/cpp/compiler_support/20
The list still misses a few proprietary ones on the embedded space.