mercredi 21 février 2018

Best/proper way to define uint64_t constants

constexpr auto v = static_cast<std::uint64_t>(1); is not ideal, because of the tedious syntax and the cast which is semantically indirect. From this thread, I learned constexpr auto v = UINT64_C(1); However, the precise semantics of the macro is

expands to an integer constant expression having the value specified by its argument and the type uint_least64_t.

Therefore, it's not exactly uint64_t. I'm wondering what is the best/proper way to define uint64_t constants.

Aucun commentaire:

Enregistrer un commentaire