Liste des Groupes | Revenir à cl c |
Em 10/11/2024 4:17 PM, Bonita Montero escreveu:With constexpr you could enforce that the expression you assign isAm 11.10.2024 um 20:11 schrieb Thiago Adams:yes. but?
>
>
>constant expression make sense in C. It is not new, it is very old.>
const has a definition and it allows non compile-time evaluated
variables.
What I am suggesting again is remove the keyword constexpr. make const do that.
Just to remember C++ was already like that before constexpr. In c++ const could be used as constant expressions.
What C++ could not ensure is that global variables would have a compile time initialization.
In C all global variables are initialized in compile time.
For local variables like...
const int i = ... ;
the compiler must evaluate the initialization expression if it can be computed in compile time then i is "constexpr" does not matter if it have or not the constexpr keyword.
Les messages affichés proviennent d'usenet.