Liste des Groupes | Revenir à cl c |
Em 8/2/2024 10:31 PM, Keith Thompson escreveu:Thiago Adams <thiago.adams@gmail.com> writes:>
[...]It is interesting to compare constexpr with the existing constantI'm not sure what you mean by "Compilers extend to work with
expression in C that works with integers.Compilers extend to work with
unsigned long long.
constexpr works with the sizes as defined , for instance char.
unsigned long long.".
enum {C = 18446744073709551615 -1 };
// ~~~~~~~~~~~~~~~~~~~~
// ^ warning: integer constant is so large that it is unsigned
>
https://godbolt.org/z/K7hzczETP
This part "shall only have operands that are integer constants"
>
From C23
>
"An integer constant expression132) shall have integer type and shall
only have operands that are
integer constants, named and compound literal constants of integer
type, character constants,
sizeof expressions whose results are integer constants, alignof
expressions, and floating, named,
or compound literal constants of arithmetic type that are the
immediate operands of casts. Cast
operators in an integer constant expression shall only convert
arithmetic types to integer types,
except as part of an operand to the typeof operators, sizeof operator,
or alignof operator."
Les messages affichés proviennent d'usenet.