News for hackers. Stuff that matters.
Re:C++17’s Useful Features for Embedded Systems by gpderetta on Tuesday May 30, 2023 @10:16AM (#36125146)
The reason the standard doesn't guarantee constant evaluation of constexpr is that it would be hard, because of the as-if rule, to specify it in an good way other than a non-normative comment. Remember that as long as the sequence of side effects is preserved (and even that, concurrency introduce non-determinism), any translation is compliant (even no translation in case of interpretation).

In practice you do get guaranteed evaluation wherever the result is required at compile time (for example as a non-type template parameter or as an array size).

There are no comments on this comment yet.