Date: Mon, 25 Aug 2025 05:57:10 +0000
One thing that strikes a nerve with me is that if you declare a function inline neither MSVC or GCC actually inline anything, as far as I was able to observe only clang seems to respect the keyword.
You actually need to use a non-portable compiler specific keyword in order to (pretty please with sugar on top, just freaking do it and) actually get it to do what you want. There's already a keyword that exists in the standard to do this job, and it is complete BS to have to use a different non-portable one to make things work.
I think the standard can be made normative in this regard, as well as offer additional mechanisms that if a function inputs are all constant expressions, the result itself should also be a constant expression.
-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Thiago Macieira via Std-Proposals
Sent: Monday, August 25, 2025 07:39
To: std-proposals_at_[hidden]
Cc: Thiago Macieira <thiago_at_macieira.org>
Subject: Re: [std-proposals] The real problems with optimizing C++ are not getting better
On Sunday, 24 August 2025 18:12:00 Pacific Daylight Time Adrian Johnston via Std-Proposals wrote:
> Recently I spent some time looking at the generated assembly from gcc
> and clang and it doesn't look like the situation has improved in 30
> years.
Then I don't know where you were 30 years ago. The situation has MUCH improved in all aspects I can tell. It's heads and shoulders above what the compilers generated 15 years ago. There was a time when GCC was a bit of a joke in optimisation - I remember a situation when one would take the assembly generated by MSVC, decompile it back into C or C++ so GCC would end up doing the right thing. Now it's the complete reverse: MSVC has fallen behind while GCC and Clang "one up" each other in terms of optimisations.
30 years ago we didn't have link-time optimisations. Unnamed-namespace variables did not become local symbols and hidden visibility wasn't taken into account in inlining. In fact, no one used hidden visibility. And LLVM didn't exist.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Principal Engineer - Intel Platform & System Engineering
You actually need to use a non-portable compiler specific keyword in order to (pretty please with sugar on top, just freaking do it and) actually get it to do what you want. There's already a keyword that exists in the standard to do this job, and it is complete BS to have to use a different non-portable one to make things work.
I think the standard can be made normative in this regard, as well as offer additional mechanisms that if a function inputs are all constant expressions, the result itself should also be a constant expression.
-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Thiago Macieira via Std-Proposals
Sent: Monday, August 25, 2025 07:39
To: std-proposals_at_[hidden]
Cc: Thiago Macieira <thiago_at_macieira.org>
Subject: Re: [std-proposals] The real problems with optimizing C++ are not getting better
On Sunday, 24 August 2025 18:12:00 Pacific Daylight Time Adrian Johnston via Std-Proposals wrote:
> Recently I spent some time looking at the generated assembly from gcc
> and clang and it doesn't look like the situation has improved in 30
> years.
Then I don't know where you were 30 years ago. The situation has MUCH improved in all aspects I can tell. It's heads and shoulders above what the compilers generated 15 years ago. There was a time when GCC was a bit of a joke in optimisation - I remember a situation when one would take the assembly generated by MSVC, decompile it back into C or C++ so GCC would end up doing the right thing. Now it's the complete reverse: MSVC has fallen behind while GCC and Clang "one up" each other in terms of optimisations.
30 years ago we didn't have link-time optimisations. Unnamed-namespace variables did not become local symbols and hidden visibility wasn't taken into account in inlining. In fact, no one used hidden visibility. And LLVM didn't exist.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Principal Engineer - Intel Platform & System Engineering
Received on 2025-08-25 05:57:13