C++ Logo

std-proposals

Advanced search

Re: [std-proposals] constexpr support for std::chrono::system_clock

From: Nikolaos D. Bougalis <nikb_at_[hidden]>
Date: Fri, 07 Mar 2025 00:32:01 +0000
On Thursday, March 6th, 2025 at 16:03, Marc Edouard Gauthier <MarcEdouard.Gauthier_at_[hidden]> wrote:

> If this were done, I’d expect it to be a new function, maybe named compile_time().

The proposal briefly discusses that. I don't think having a separate function makes sense.


> And I would certainly not assume it enables timing compilation time, that’s not necessarily how a compiler works evaluating its constexpr expressions.

I don't know the finer details of how compilers evaluate constexpr expressions, and perhaps the idea of timing constexpr code is bunk, but even if it is, there are other good reasons (imo) to have the capability.


>Of course some compiler option probably disables it or makes it return a defined value or such, for those who need reproducible builds.

Pardon me, but you're the second person to raise objections vis-à-vis reproducible builds and I must confess I am confused.

Even if this functionality were added, it would not affect reproducible builds in _any_ way, _unless the developers of the software chose to use it_! Given that it is largely incompatible with reproducible/deterministic builds, why would they?

I certainly agree that discussing this issue merits a mention in the proposal, and as a quality-of-implementation feature, I think it should be something that a developer can "opt out" of.

But I don't think it's a real criticism of this proposal nor a good faith reason to not implement it.

Best regards,

Nik Bougalis

Received on 2025-03-07 00:32:05