Date: Wed, 2 Jul 2025 16:34:40 +0200
If the code between sleep_until() and clock::now() is not an observable checkpoint, but in practice takes many cycles, it is possibly not enough to fulfill zsar's requirement.
It is generally hard to combine the as-if rule with code for timing or benchmarking.
C++ could have asked an oracle, which is always right, for the result (or used a cached result for a provably pure function).
If the computation has nothing to do with observable checkpoints, the computations should be able to be moved around or replaced.
We cannot demand, that the compiler burns cycles unnecessary by redoing superfluous work.
That makes C++ more difficult to use for hard real-time applications (with an absolute and defined upper limit of cycles for certain code blocks).
-----Ursprüngliche Nachricht-----
Von:Jonathan Wakely via Std-Proposals <std-proposals_at_[hidden]>
I don't agree that it's a valid transformation to move such clock::now() calls, but we could standardize that by saying that for all the standard clocks, now() is an observable checkpoint.
Received on 2025-07-02 14:43:43