C++ Logo

std-proposals

Advanced search

Re: [std-proposals] The real problems with optimizing C++ are not getting better

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Mon, 25 Aug 2025 16:07:34 +0000
I care substantially for constexpr, it can reduce what could be quite substantial amount of computation to a runtime constant.
And compiler should be able to be more aggressive here, if it can be compile time it should be compile time (if more optimal).

If you don't use it, or you don't understand enough to care maybe that discussion is not for you, and that is fine.


________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Adrian Johnston via Std-Proposals <std-proposals_at_[hidden]>
Sent: Monday, August 25, 2025 5:54:30 PM
To: Ivan Matek <libbooze_at_[hidden]>
Cc: Adrian Johnston <adrian3_at_[hidden]>; std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Subject: Re: [std-proposals] The real problems with optimizing C++ are not getting better

> That is not how I or many people view things. We know most of the time compiler does very good job, but sometimes it fails.

That was sarcasm. It you want to get people's attention, just say
something wrong.

> This is not true. constexpr matters. Same for const. For example this code without constexpr will not compile.

I am not suggesting the standard somehow defined constexpr to do
nothing at all. What I am saying is there is a distinction between
"it can be evaluated at compile time" and "the code generator will
more thoroughly evaluate it at compile time than any other code if it
doesn't have to." Can you show me an example of constexpr resulting in
better code generation at runtime (and not compile time?)

Ok, but I have been writing C++ for 20 years and I still don't have
any idea what people are doing running all this code C++ at compile
time. I know of examples from numerical computing that are
compelling. My only use case failed horribly and silently. Yeah, sure
constexpr is better than template meta programming, but that wasn't a
problem we had all day long.
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2025-08-25 16:07:39