You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kremlin is careful to produce constant values with predictable behavior, despite ambiguities in C about integer promotion due to sizeof(int) and signed-ness of char.
Examples:
(uint32_t)1U
(uint32_t)0U
(int32_t)1
(int32_t)0
I think Kremlin could omit the casts in a number of cases, while still being certain that the ambiguous cases are well handled. I believe it is safe for constants < 16 bits in length, where it already emits the 'U' suffix for unsigned, or omits it for signed.
For larger constants, close to sizeof(int) on a 16-bit machine, the explicit casts will still be important.
The text was updated successfully, but these errors were encountered:
Kremlin is careful to produce constant values with predictable behavior, despite ambiguities in C about integer promotion due to sizeof(int) and signed-ness of char.
Examples:
(uint32_t)1U
(uint32_t)0U
(int32_t)1
(int32_t)0
I think Kremlin could omit the casts in a number of cases, while still being certain that the ambiguous cases are well handled. I believe it is safe for constants < 16 bits in length, where it already emits the 'U' suffix for unsigned, or omits it for signed.
For larger constants, close to sizeof(int) on a 16-bit machine, the explicit casts will still be important.
The text was updated successfully, but these errors were encountered: