C++ Logo

std-proposals

Advanced search

Re: [std-proposals] goto is not harmful (was: "once" keyword)

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Wed, 24 May 2023 19:35:21 -0400
On Wed, May 24, 2023 at 12:00 PM sasho648 via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Weird how that should even be concern of the committee. Just give the syntax and allow implementations to decide what can they implement as `constexpr` or not.
>
> Maybe only impose "minimal requirements" for what needs to be able to be evaluated at compile time.

... what exactly would be the point of this? I mean, right now,
compilers can evaluate *anything* they want at compile-time. Nothing
is stopping them.

`constexpr` is not for "maybe my compiler can do something with this".
It's for "when I call this in a place that *requires* a constant
expression, evaluate it at compile-time". It's not a statement of a
preference; it's a *requirement*, one that places burdens on the
compiler.

If you cannot rely on `constexpr` actually being a constant expression
when you need it to be, then what is the point of the feature?

Received on 2023-05-24 23:35:33