Date: Fri, 7 Mar 2025 07:03:16 +0000
The simplest solution would be to just create a shell script that generates a file with the current time, let the build system call that shell script before build, and then not touch the compiler.
That's what I do (and I don't think I'm the only one).
Not everything needs to be a feature of the compiler.
As for UUID. A time stamp is not a reliable way to create a UUID, so I'm not even going to bother with that use case.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Jan Schultke via Std-Proposals <std-proposals_at_[hidden]>
Sent: Friday, March 7, 2025 7:19:32 AM
To: std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc: Jan Schultke <janschultke_at_[hidden]>
Subject: Re: [std-proposals] constexpr support for std::chrono::system_clock
I've got a much simpler alternative idea: we could say that every clock has a
> static constinit const time_point translation_time;
... data member. There is no potential for ODR violations because you
cannot access it during constant evaluation anyway. It's simply saying
that you're baking the timestamp into the executable. The linker could
still optimize it out if it's unused.
That's what I do (and I don't think I'm the only one).
Not everything needs to be a feature of the compiler.
As for UUID. A time stamp is not a reliable way to create a UUID, so I'm not even going to bother with that use case.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Jan Schultke via Std-Proposals <std-proposals_at_[hidden]>
Sent: Friday, March 7, 2025 7:19:32 AM
To: std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Cc: Jan Schultke <janschultke_at_[hidden]>
Subject: Re: [std-proposals] constexpr support for std::chrono::system_clock
I've got a much simpler alternative idea: we could say that every clock has a
> static constinit const time_point translation_time;
... data member. There is no potential for ODR violations because you
cannot access it during constant evaluation anyway. It's simply saying
that you're baking the timestamp into the executable. The linker could
still optimize it out if it's unused.
-- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-03-07 07:03:22