3 ms·
> In real life, there’s basically no reason ever to use constexpr on a stack variable Wait what? This is what i was doing right now. It defines a local compile
by beyondCritics 3y ago
> In real life, there’s basically no reason ever to use constexpr on a stack variable
Wait what? This is what i was doing right now. It defines a local compile time constant and hence is an important mean to express an abstract concept.
You could use a macro, but we are told to get rid of them. And a local const variable is an entirely different thing.
- twic 3y agoI think the idea is that things like that should be static constexpr. They have the same lexical scope but don't take up space on the stack. Surely any competent optimiser will make them the same though.