News for hackers. Stuff that matters.
Re:LLVM 13.0 by RcouF1uZ4gsC on Tuesday October 05, 2021 @12:15PM (#28761464)
Looking at the release notes for Clang, there are no new C++20 features. Clang is really falling behind GCC and even Microsoft Visual C++ with regards to C++20 implementation.

https://en.cppreference.com/w/cpp/compiler_support/20

Re:LLVM 13.0 by pjmlp on Tuesday October 05, 2021 @12:25PM (#28761590)
The two main backers (Apple and Google) seem to have backed out.

From my point of view, for Apple, their use of C++, C++17 is good enough.

Metal uses a C++14 dialect as shading language, IO and DriverKit an embedded friendly subset, for everything else there is Objective-C and Swift.

Google seems to have been put off by losing the ABI vote and changed focus into Abseil instead, and have their own Draconian style guide anyway.

And are increasingly adopting Rust as well.

Intel, ARM, IBM, Sony, Nintendo will have to jump in.

By the way, concepts were mostly implemented by a single guy!

Re:LLVM 13.0 by dxf on Tuesday October 05, 2021 @04:24PM (#28765120)
>The two main backers (Apple and Google) seem to have backed out.

Google has not "backed out".

E.g. look at this topic's discussion thread. The current top comment is about [[clang::musttail]]; the implementor of that attribute works for Google. The current second top comment is about the Rust compilation wins from the switch to the New Pass Manager; the NPM was primarily implemented by (and turned on as the default pass manager upstream) by people who work for Google. Google is actually growing our investment in people contributing to core Clang/LLVM.

Source: I am a manager for C++ toolchains (those that target production, Chrome, ChromeOS) at Google.

Re:LLVM 13.0 by pjmlp on Tuesday October 05, 2021 @04:36PM (#28765281)
From the point of view from C++20 support it definitely looks like that from the outside.

Which you pretty much confirmed by giving examples completely unrelated to ISO.

How is that migration to C++20 modules support going?

Re:LLVM 13.0 by dxf on Tuesday October 05, 2021 @05:45PM (#28766046)
If you are asking, "Is Google helping with any C++20 support upstream?" the answer is Yes.

E.g. for standard concepts in libc++:

std::derived_from (D74292) std::convertible_to (D77961) Arithmetic concepts (D88131) std::move_constructible (D96230) std::copy_constructible (D96232) std::invocable (D96235) std::regular_invocable (D96235) etc.

Google is _big_ and C++ is used for many projects that build with disparate toolchains (even if they are all based on Clang/LLVM); each project can have different needs to adopt parts of C++20 sooner than the others, and different costs for doing so. Moving from Clang modules to C++ standard modules is an effort that, for some of our projects, lives at the nexus of "Are Standard Modules sufficiently done upstream to be able to replace our use of Clang modules?" and "What is the cost of doing that?" and "What is the benefit of making that switch?" For other projects, adopting standard modules is a more straightforward calculus.

Re:LLVM 13.0 by pjmlp on Wednesday October 06, 2021 @01:58AM (#28769691)
Fair enough, thanks for the clarification.
Re:LLVM 13.0 by boris on Tuesday October 05, 2021 @01:25PM (#28762545)
> The two main backers (Apple and Google) seem to have backed out.

This highlights an important difference between GCC and LLVM that many fans of the latter seem to miss: LLVM is first a bunch of compiler components that Apple and Google use for their own needs and a C/C++/etc compiler for you and me second and only as long as it flows naturally from the first. While GCC is a C/C++/etc compiler, that's the end-goal.

Re:LLVM 13.0 by volta83 on Tuesday October 05, 2021 @02:24PM (#28763469)
The people working on GCC are also mostly paid by companies, e.g., like Red Hat. The moment these companies back out, the same thing will happen to GCC.

The root of the problem is that very few people find it "FUN" to implement C++ compilers on their free time, so these open source projects live from companies for contributions.

Re:LLVM 13.0 by bluescarni on Tuesday October 05, 2021 @02:31PM (#28763571)
No.

GCC existed and thrived long before companies started putting money into it. It would clearly suffer if, e.g., Red-Hat withdrew its support, but not nearly as LLVM would in the same situation.

The culture, history and governance of the two projects are very different and they do matter.

Re:LLVM 13.0 by volta83 on Wednesday October 06, 2021 @10:32AM (#28773629)
> but not nearly as LLVM would in the same situation.

LLVM has the support of most compiler research groups across the globe, so in contrast with GCC, there is a steady flow of "LLVM PhD"s coming out of academia in need of a job, and "LLVM PhD"s becoming professors and continuing doing research with LLVM, and then a large set of CS students doing all kind of works with those professors on LLVM, which creates a steady flow of "BSc"/"MSc" LLVM professionals.

On top of that, many technology companies have built their whole platforms on top of LLVM.

GCC doesn't really have that. If Red-Hat and other private companies withdraw support, there are really few people familiar enough with GCC to keep it afloat, few people interested in learning and contributing because that won't land them industry jobs, etc.

Re:LLVM 13.0 by bluescarni on Thursday October 07, 2021 @03:54AM (#28783409)
> On top of that, many technology companies have built their whole platforms on top of LLVM.

That is irrelevant, as most of those companies are keeping their modifications to LLVM closed-source. They are not at all interested in fostering a healthy open-source ecosystem around LLVM.

> GCC doesn't really have that.

This is just wrong. Just as a single example, the first ever C++ concepts implementation was written for GCC by Andrew Sutton, a University professor and co-author with Bjarne of the concepts proposal. LLVM's implementation came years later, and it's not as stable or complete to this day.

> If Red-Hat and other private companies withdraw support, there are really few people familiar enough with GCC to keep it afloat, few people interested in learning and contributing because that won't land them industry jobs, etc.

Again, no. There is nothing in the 30+-years long history of GCC that suggests that this would happen.

Re:LLVM 13.0 by volta83 on Thursday October 07, 2021 @08:42AM (#28785476)
> That is irrelevant, as most of those companies are keeping their modifications to LLVM closed-source. They are not at all interested in fostering a healthy open-source ecosystem around LLVM.

AMD, Intel, ARM, ... they all have proprietary toolchains built on LLVM, and send and merge multiple diffs to LLVM upstream, every day.

> GCC doesn't really have that. This is just wrong. Just as a single example,

If that's your main example, you are in for a ride. Since asutton branch is over 15 years old almost at this point, and it was by design that no work should happen in LLVM until concepts make it into the standard.

I can give you a dozen examples, from constexpr, metaclasses, coroutines, modules, etc. where things made it much earlier into LLVM than GCC.

> Again, no. There is nothing in the 30+-years long history of GCC that suggests that this would happen.

From 2005 to 2014 GCC development severely stagnated, being much slower than clang, having horrible error messages when compared to clang, etc. It was not until after 2016 where some open source companies, like redhat, started pouring more money into GCC that this started to change. The moment these companies are out, the same thing will happen.

Re:LLVM 13.0 by bluescarni on Wednesday October 13, 2021 @10:44AM (#28852773)
> If that's your main example, you are in for a ride. Since asutton branch is over 15 years old almost at this point, and it was by design that no work should happen in LLVM until concepts make it into the standard.

Nice strawman, what does this have to do with anything that I wrote?

You went on and on about how there's heaps of "LLVM PhDs" (whatever that might mean) coming out of academia, so I gave you an example of someone working in academia who developed and contributed a key C++ feature to GCC.

> I can give you a dozen examples, from constexpr, metaclasses, coroutines, modules, etc. where things made it much earlier into LLVM than GCC.

That's not my experience, and I have been using GCC and Clang daily on modern C++ codebases targeting the latest standard for the last 10 years.

> From 2005 to 2014 GCC development severely stagnated, being much slower than clang, having horrible error messages when compared to clang, etc.

Yes, GCC's diagnostics have been trailing Clang's, though they have mostly caught up in the last few versions. But "much slower than clang" is flat out wrong, unless you mean compile-time performance. GCC has for years consistently produced more optimised code than Clang's, and it only in the last couple of years that the two compilers are essentially on performance parity.

> AMD, Intel, ARM, ... they all have proprietary toolchains built on LLVM, and send and merge multiple diffs to LLVM upstream, every day.

I seriously doubt that AMD/Intel/ARM engineers are doing substantial work on C++20 features, but I'd be happy to be proven wrong :)

Re:LLVM 13.0 by jabl on Tuesday October 05, 2021 @12:49PM (#28762002)
> Intel, ARM, IBM, Sony, Nintendo will have to jump in.

Intel and IBM have recently announced their own proprietary LLVM-based compilers, but they seem more interested in backend work to make their own CPU's look good [1] than spending resources on frontend work. I guess that applies to ARM as well.

Sony and Nintendo are, I guess, mostly satisfied? They just want a decently good compiler and toolchain ecosystem, but for games most performance comes from the GPU anyway, chasing low-single-digit performance increases for CPU code doesn't seems like a super good investment opportunity for a game console company.

Re:LLVM 13.0 by nerdponx on Tuesday October 05, 2021 @02:58PM (#28763962)
Is it possible that they're making lots of internal improvements and not upstreaming them?
Re:LLVM 13.0 by pjmlp on Tuesday October 05, 2021 @05:37PM (#28765954)
Definitely, Sony for example doesn't upstream stuff that might reveal architecture details that could help piracy.

There are a couple of talks from them at some LLVM summits.

Re:LLVM 13.0 by mwcampbell on Tuesday October 05, 2021 @01:18PM (#28762411)
It surprises me, though, that GCC is ahead (assuming the GP is correct). Anyone here know who's driving C++20 support in GCC?
Re:LLVM 13.0 by pjmlp on Tuesday October 05, 2021 @01:30PM (#28762612)
Red-Hat mostly.
Re:LLVM 13.0 by rnd0 on Tuesday October 05, 2021 @02:25PM (#28763490)
Oof. Anyone else worried about the amount of GNU infrastructure (GCC, GLibc, etc) that has fallen into IBM's hands -and what will happen with it in the future?
Re:LLVM 13.0 by pjmlp on Tuesday October 05, 2021 @02:39PM (#28763696)
Well, IBM among others, provided the initial money to make Linux relevant anyway.

> Commercial use began when Dell and IBM, followed by Hewlett-Packard, started offering Linux support to escape Microsoft's monopoly in the desktop operating system market

-- Wikipedia

Re:LLVM 13.0 by rnd0 on Tuesday October 05, 2021 @02:48PM (#28763829)
Linux isn't GNU, and there have been a rise of projects that prove exactly that.

If we reach the point where redhat pulls the cash out from GNU then there's a lot of infrastructure that will be lost. I find it alarming that no one ever seems to mention that.

Re:LLVM 13.0 by dralley on Tuesday October 05, 2021 @03:13PM (#28764196)
Perhaps people should worry less and contribute more, to prevent such concerns from becoming problems in the first place.

If your company is making use of Linux, GCC, OpenSSL and so forth, they should be setting aside some engineering resources to contribute to those projects, especially if they aren't paying a corporate vendor like RH, SUSE, or Canonical to do it on their behalf.

Naturally, the "tragedy of the commons" is that everyone wants to take advantage of free software while contributing back as little as possible, usually while simultaneously complaining or handwringing about those that are actually contributing.

Why is it that this conversation has turned from Apple and Google, with a combined market cap over 4 trillion dollars pulling their resources from these foundational projects, to handwringing that Red Hat, with a 125x smaller valuation might pull their resources from GNU, something there is no indication of happening? Surely the focus ought to be in the other direction...

Re:LLVM 13.0 by rofrol on Wednesday October 06, 2021 @04:55AM (#28770708)
>As of October 2021 IBM has a market cap of $128.91 Billion. This makes IBM the world's 112th most valuable company by market cap according to our data.

https://companiesmarketcap.com/ibm/marketcap/

Re:LLVM 13.0 by jabl on Wednesday October 06, 2021 @01:15AM (#28769457)
> If we reach the point where redhat pulls the cash out from GNU then there's a lot of infrastructure that will be lost. I find it alarming that no one ever seems to mention that.

IIRC Redhat withdrew funding from FSF after they decided to put RMS back on the board. But AFAICS they haven't reduced funding for developing GNU software.

Lets put it this way; RH doesn't contribute to GCC out of the goodness of their hearts, but due to GCC being a critical component of the Linux distro (RHEL) and other similar product support offerings they make their money from. If they drop GCC development, it'll be because something else has replaced GCC and they figure it's better to concentrate their efforts there, or because their business as a whole is going down the drain. For the time being I don't really see either option as particularly likely.

Re:LLVM 13.0 by nsajko on Tuesday October 05, 2021 @12:57PM (#28762096)
It's not just modern C++ support. C/C++ implementations mostly get taken for granted, but taking a look at the LLVM bug tracking is horrifying - there are huge amounts of years-old reports that nobody seems to be working on even though they're serious. Even things like valid C++ code failing to compile because Clang fails to parse it, if I remember correctly.

I don't have a point with this other that it's surprising (for end-users like me). Also, I'm not sure how GCC compares.

Re:LLVM 13.0 by woodruffw on Tuesday October 05, 2021 @03:23PM (#28764341)
> Also, I'm not sure how GCC compares.

Not favorably. Both projects have massive "backlogs," by naive metrics.

Maintainers for both are in a double bind: people get mad when you close their years-old issues because they can't be reproduced anymore, and people give you grief for not closing issues.

Re:LLVM 13.0 by zauguin on Tuesday October 05, 2021 @02:15PM (#28763324)
According to clang's C++20 status list, clang 13 adds `using enum`, more implicit moves and partial support for lambdas in unevaluated contexts.
Re:LLVM 13.0 by google234123 on Tuesday October 05, 2021 @03:03PM (#28764050)
Are many of the C++20 features even ready for prod? ranges, concepts, modules...?
Re:LLVM 13.0 by pjmlp on Tuesday October 05, 2021 @04:39PM (#28765315)
Re:LLVM 13.0 by Koshkin on Tuesday October 05, 2021 @05:19PM (#28765750)
GCC FTW
Re:LLVM 13.0 by crispyalmond on Tuesday October 05, 2021 @08:27PM (#28767605)
I'm super impressed by MSVC these days. The team is doing good!
Re:LLVM 13.0 by pjmlp on Wednesday October 06, 2021 @01:09AM (#28769422)
In what concerns ISO C++ compliance, yes.

In what concerns throwing out C++/CX out of the window and tell us to go back to the days of ATL 3.0, and wait for the day Herb's metaclasses arrive into the standard, not so much.

Re:LLVM 13.0 by Koshkin on Wednesday October 06, 2021 @07:49AM (#28771944)
I think Microsoft did the right thing here. A proprietary extension to a programming language is expected to be short-lived anyway, unless it makes its way into the standard, which is something that must be planned for from the beginning.
Re:LLVM 13.0 by cracauer on Tuesday October 05, 2021 @12:31PM (#28761694)
Sadly format did not make it.
Re:LLVM 13.0 by Thev00d00 on Tuesday October 05, 2021 @03:31PM (#28764454)
but we have fmtlib thank goodness
Re:LLVM 13.0 by cute_boi on Tuesday October 05, 2021 @12:22PM (#28761557)
also it doesn't support many hardware compared to gcc and people seem to be more crazy about it idk why :(
Re:LLVM 13.0 by h2odragon on Tuesday October 05, 2021 @03:00PM (#28763991)