News for hackers. Stuff that matters.
Re:Proposal to add constexpr to C [pdf] by dataflow on Saturday October 16, 2021 @02:56PM (#28890403)
constexpr on a variable declaration does that (i.e. it's still superfluous on function declarations, which is where it clutters code by far the most). But even for that, there was already std::integral_constant which would've forced this, and they could've just updated it to C++20 via template<auto Value> static const auto constant = Value; if they really wanted to. Or added an [[attribute]] for variable declarations, just like how we have [[likely]] etc. No need to introduce a whole new keyword for this, especially not in a ton of other contexts.
Re:Proposal to add constexpr to C [pdf] by electroly on Saturday October 16, 2021 @03:29PM (#28890699)
Those suggestions, honestly, don't sound better than the keyword to me. I think you're taking it as a given that if a keyword can be avoided, it must be avoided, but I don't fundamentally agree with that at all.
Re:Proposal to add constexpr to C [pdf] by dataflow on Saturday October 16, 2021 @03:37PM (#28890763)
I mean your (only?) argument for the constexpr keyword at this point is "it can be a keyword and I feel like it should be, even when I acknowledge it's redundant" then by all means go ahead. Personally I don't think that's a good way to do language design, but I can't argue with subjective feelings and aesthetics and I was never intending to. I'm pretty sure that's not one of the bases on which it made it into the standard though, and those are what I'm trying to address.