Comment

Comment by nuerow

> If you want to look at it that way, it only applies to variable declarations at best. Not function declarations, which is the most common case of where it's used (and it completely clutters the code).

Not really. The whole point of constexpr is to state that an expression is constant, thus the value returned by the function is computed at compile time.

> And honestly, if that was the value proposition, they could've just done it a million other ways.

To me it seems thay annotating a function with constexpr is the clearest and most straight-forward way to go about expressing constant expressions.

> Also I think you're thinking more of consteval than constexpr.

To each his own, but if the whole point is to represent constant expressions then the constexpr keyword seems to be straight-forward.

parent nuerow 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton