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 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.Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
@RichFelker@ch3root@matthew_d_green When promoted int result of arithmetic expression is assigned to shorter uint32 var, compiler shd warn -
@RichFelker@ch3root@matthew_d_green C doesn't do arithmetic in any size smaller than int, and int here is bigger than uint32_t.
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.