6 ms·
I've always preferred clang for its better lints, and friendlier error messages (sans some decrepit parts around templates that are equally horrendous everywher
by spoiler 4y ago
I've always preferred clang for its better lints, and friendlier error messages (sans some decrepit parts around templates that are equally horrendous everywhere)...
And theoretically clang has better ASM output in some cases
I say theoretically, because it's been shown that GCC's "worse" ASM performs better; I'm not really an architecture aficionad, so I can't comment as to why that is.
Also, it's been a few years now since I did C/C++. So, maybe these are no longer the case.
Anyway, I've kinda pointed out what I like about clang over gcc, but I'd be curious what you prefer in gcc.
- hi_herbert 4y agoI wonder how up to date is the old belief of better error messages. The was some great redhat blogs about structured error messages in newer GCC.
- spoiler 4y agoOk, that's kinda true I suppose; I remember that GCC's error messages have indeed gotten better after a major version release. Also, when you say structured, do you mean errors over LSP, or do you mean more structure in the formatting when reporting in CLI?
- bayindirh 4y agoGCC returns pretty nice, colored and structured error messages in CLI for quite some time.
- hi_herbert 4y agoI meant in cli a bit like rust arrows logs
- yakubin 4y agoGCC has gotten better indeed, but it's still in a different league than Clang. I still get into situations where I can't make heads-or-tails of what GCC is saying to me, which can usually be easily solved by switching to Clang.
- hi_herbert 4y agoI don't do C++ anymore but I will forever remember the Vtable hell "messages" when doing OOP and doing a slight unintuitive mistake about destructor or constructor. Is this still a thing in clang?
- nikic 4y agoOne problem here is that GCC emits certain warnings as part of the optimizer, which results in many false positives that are essentially impossible for the lay programmer to understand. For example, jump threading might duplicate some code path and propagate constants in it, and then warn about an uninitialized variable / out of range access / etc in that code-path, even though it does not exist in that form in the original program.
- MauranKilom 4y agoFunny enough, this is exactly the kind of situation where other people cry "why did the compiler not warn me about basing optimizations on UB".
- newobj 4y agoclang doesn't output asm
- spoiler 4y agoI'm not sure what you mean? You can use `-S`