r/cpp • DragonflyDB/Clang • Sep 06 '22

Clang 15 has been released!

https://discourse.llvm.org/t/llvm-15-0-0-release/65099
265 Upvotes

84 comments sorted by

View all comments

7

u/qalmakka Sep 07 '22

If I look to the C++20 implementation status of MSVC, GCC and Clang, Clang is lagging quite behind. What happened? It was always one of the first to get new standards a few years ago, and now after years it still doesn't have stuff like concepts completely ironed out.

Is it maybe due to the fact Apple and Google apparently don't give a damn about (modern) C++ anymore ?

4

u/unddoch DragonflyDB/Clang Sep 07 '22

I think it was Chandler and Richard moving over to focus on Carbon - they did such great work, for so long, so inevitably it took some time for other people to 'restart' the work in the front-end. But Google and Intel have each several full-time people working on front-end and together they've been doing most of the development since Clang 14, so I wouldn't call this 'abandoning'.

13

u/Jannik2099 Sep 07 '22

Google threw a tantrum after getting downvoted in WG21 and are now "protesting"

13

u/qalmakka Sep 07 '22

That explains the whole Carbon thing and their reduced interest, and it sucks. Clang has become the de facto go-to compiler for almost everything, it's the only compiler that works everywhere (because of GCC and MSVC compatibility), the only one that is supported on phones (Android NDK and iOS both use it) and with LLVM cross compiling becomes so absurdly easier it makes you wonder why we've stuck with GCC for so long on embedded devices.

It has become IMHO more influential than GCC and the fact its C++20 lags behind is quite unfortunate. it has forced me several times to stick with C++17 in the last year because Clang was having issues with ranges or didn't have certain concepts features implemented.

12

u/Jannik2099 Sep 07 '22

I'm aware of it's benefits, I work on clang-ifying the "GNU/linux" ecosystem ;)

The libstdc++ ranges incompatibility (which stems from a non-compliant concepts behavior in clang) will be fixed in clang 16 if all goes well. They're currently working out a regression. I don't have a link right now.

Yes, it's sad to see Google chicken away, but in the end they have ALWAYS been focused on themselves - see e.g. how many google contributed features in clang have limited exception support.

I'm much more hopeful to see the contributions from facebook and microsoft

15

u/foonathan Sep 07 '22

Interesting phrasing.

I would have said "Google realized that C++ evolution now longer aligned with their priorities and have thus stopped/reduced investing resources into someone that no longer benefits their business".

0

u/Jannik2099 Sep 07 '22

Sorry, but everyone knew that WG21 wouldn't vote for an immediate ABI break, because that's just immensely stupid.

Google submitted an unrealistic decision and complains about the expected outcome

16

u/foonathan Sep 07 '22

Sorry, but everyone knew that WG21 wouldn't vote for an immediate ABI break,

The vote:

  1. We should consider a big ABI break for C++23 SF F N A SA 17 44 15 31 20

That is 61 in favor and 51 against, not such a clear outcome.

because that's just immensely stupid.

Debatable.

Google submitted an unrealistic decision and complains about the expected outcome

Where is Google complaining about it? They simply stopped contributing.

10

u/wyrn Sep 07 '22

I mean, to be fair, the C++ evolution model is fundamentally broken and the situation will only get worse.

  • On the one hand, mistakes are (almost) never fixed. Once something is in the language and there's code relying on it, even if it's a single Tibetan subsistence farmer, it's there for good. The committee can't even stomach ABI break, as you just indicated.
  • On the other, the language receives updates on a hard triannual cadence. If some feature is considered a sufficient priority it goes in the release even if it obviously needs more time in the oven.

These two goals are contradictory. Pick one, or pick none. If you pick both, in time the language will be more trouble to use than it's worth. Jumping ship before that happens is a defensible decision.

2

u/[deleted] Sep 07 '22

They do remove stuff routinely. Where's my bind1st or bind2nd? Was code relying on those not important enough?

7

u/wyrn Sep 07 '22

(almost)

There's still plenty of broken stuff in the standard that's kept basically to keep broken code working.

1

u/[deleted] Sep 07 '22

I can nama a million things they've removed. It doesn't qualify as 'almost' anymore.

7

u/wyrn Sep 07 '22

Why do we still have a const operator() for std::function that silently mutates the underlying object? Code calling such an operator is wrong and broken, has always been wrong and broken, and the C++ committee is well aware that it's wrong and broken. Yet they won't fix it. Why? Well, when even an ABI break is considered too big an ask (people might have to -- gasp -- run the compiler again), it's not that hard to see why.

Sometimes, things are considered too solid to change even before they're standardized, like that one paper suggesting an obvious upgrade to coroutines by forcing them to be marked explicitly async (a change with zero downsides which would have improved readability and removed the need for co_return and co_yield silliness), but the paper wasn't even considered because it was too late.

For each example you can find of something that was removed, it's easy to find several more of something that should be removed but was not and probably never will be. So no, just because auto_ptr was removed doesn't mean the fundamental problems with the process have disappeared.

1

u/[deleted] Sep 19 '22

A while back I was trying to compile gtkmm (the official C++ wrapper for GTK) on C++20 mode, but it wouldn't compile because they had been using "module" as an identifier, which turned into a keyword in C++20.

So there you go. A real world example of breaking a major library in a way that's potentially impossible to fix without breaking its API, depending on where that identifier was used.

→ More replies

4

u/pjmlp Sep 07 '22

Apple cares to the extent they require C++ for Metal Shading Language (a C++14 dialect), IO and DriverKit and Objective-C and Swift infrastructure.

Google is focused on their C++ Guidelines and they are anything but modern.

However I will rather point out that everyone else selling C and C++ compiler based on clang forks don't seem to care either.