Liste des Groupes | Revenir à cl c |
Thiago Adams <thiago.adams@gmail.com> writes:I think I can explain I little betterOn 24/05/2024 16:45, Keith Thompson wrote:Your understanding is incorrect. "constexpr" is not a mere hint.Thiago Adams <thiago.adams@gmail.com> writes:>On 23/05/2024 18:49, Keith Thompson wrote:I don't understand. Do you object because it's not *immediately>error: 'constexpr' pointer initializer is not nullWhy not?
5 | constexpr char * s[] = {"a", "b"};
>
>
Then we were asking why constexpr was used in that case.
When I see a constexpr I ask if the compiler is able to compute
everything at compile time. If not immediately it is a bad usage in my
view.
obvious* that everthing can be computed at compile time? If so, why
should it have to be?
My understanding is that constexpr is a tip for the compiler. Does not
ensure anything. Unless you use where constant expression is required.
So I don't like to see constexpr where I know it is not a constant
expression.
Les messages affichés proviennent d'usenet.