Sujet : Re: constexpr keyword is unnecessary
De : Bonita.Montero (at) *nospam* gmail.com (Bonita Montero)
Groupes : comp.lang.cDate : 12. Oct 2024, 14:52:29
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <veduu9$6eql$1@raubtier-asyl.eternal-september.org>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
Am 12.10.2024 um 15:23 schrieb Thiago Adams:
With constexpr you could enforce that the expression you assign is
compile-time evaluated. That's while constexpr would make sense.
This is already the default in C for file scope variables ...
They must be optimized away by the compiler and the linker, constexpr
not. And most compile time constants that are constexpr'd in C++ are
local variables. So constexpr makes sense at least for local variables.