uint32_t a, b;
...
uint32_t c = a * b; // could result in undefined behavior if sizeof(int)>4 (h/t @RichFelker)
@Dave_Korn_ @ch3root @matthew_d_green If the operation takes place as uint32_t it's valid modular arithmetic, no reason for a warning.
-
-
@RichFelker@ch3root@matthew_d_green But it doesn't. It gets promoted to int. Isn't that the point? Am I misunderstanding you? -
@Dave_Korn_@ch3root@matthew_d_green In the case where it's promoted, there may be truncation cases but compiler may not know if they occur -
@Dave_Korn_@ch3root@matthew_d_green It may also be the case that there are no truncation cases, only overflow/UB, if int is 33-bit.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.