Hacker News new | ask | show | jobs
by brianjacobs 1294 days ago
In summary:

    constexpr variables are constant and usable in constant expressions

    constinit variables are not constant and cannot be used in constant expressions

    constexpr can be applied on local automatic variables; this is not possible with constinit, which can only work on static or thread_local objects

    you can have a constexpr function, but it’s not possible to have a constinit function declaration