News for hackers. Stuff that matters.
Re:C++20, How Hard Could It Be by spoiler on Sunday September 25, 2022 @07:20AM (#32970384)
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.

Re:C++20, How Hard Could It Be by hi_herbert on Sunday September 25, 2022 @07:41AM (#32970475)
I 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.
Re:C++20, How Hard Could It Be by yakubin on Sunday September 25, 2022 @07:50AM (#32970514)
GCC 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.
Re:C++20, How Hard Could It Be by nikic on Sunday September 25, 2022 @11:11AM (#32972072)
One 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.
Re:C++20, How Hard Could It Be by MauranKilom on Sunday September 25, 2022 @03:03PM (#32974814)
Funny enough, this is exactly the kind of situation where other people cry "why did the compiler not warn me about basing optimizations on UB".
Re:C++20, How Hard Could It Be by hi_herbert on Sunday September 25, 2022 @08:27AM (#32970683)
I 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?
Re:C++20, How Hard Could It Be by spoiler on Sunday September 25, 2022 @07:46AM (#32970498)
Ok, 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?

Re:C++20, How Hard Could It Be by bayindirh on Sunday September 25, 2022 @07:55AM (#32970533)
GCC returns pretty nice, colored and structured error messages in CLI for quite some time.
Re:C++20, How Hard Could It Be by hi_herbert on Sunday September 25, 2022 @08:28AM (#32970690)
I meant in cli a bit like rust arrows logs
Re:C++20, How Hard Could It Be by newobj on Sunday September 25, 2022 @10:43AM (#32971789)
clang doesn't output asm
Re:C++20, How Hard Could It Be by spoiler on Sunday September 25, 2022 @02:23PM (#32974334)
I'm not sure what you mean? You can use `-S`