Liste des Groupes | Revenir à cl c |
Em 10/13/2024 10:06 AM, Michael S escreveu:On Sun, 13 Oct 2024 09:38:04 -0300
Thiago Adams <thiago.adams@gmail.com> wrote:
Em 10/13/2024 8:49 AM, Bonita Montero escreveu:Am 13.10.2024 um 13:37 schrieb Thiago Adams:>
Yes.>
constexpr is like - "require the initializer to be a constant
expression." But the compiler will have to check it anyway.
I cannot understand why you are so militantly against this
new language feature that can be understood in 10 seconds.
I have seen code like this:
>
void func()
{
constexpr int c = 1;
f(c);
}
>
For some reason, people believe that adding constexpr will
magically improve optimization. In reality, it doesn't change
anything compared to const and often reflects a misunderstanding
of how the compiler works. As a result, I end up having to explain
it. In this sense, constexpr is viral and spreads confusion.
I see constexpr primarily as a way to enable use of functions from
math.h in static initializers.
Maybe you are thinking in C++? C does not have compile time functions.
Les messages affichés proviennent d'usenet.