Does integer overflow cause undefined behavior because of memory corruption?

前端 未结 6 749
Happy的楠姐
Happy的楠姐 2020-12-25 10:53

I recently read that signed integer overflow in C and C++ causes undefined behavior:

If during the evaluation of an expression, the result is not math

6条回答
  •  半阙折子戏
    2020-12-25 11:43

    It is undefined what value is represented by the int. There's no 'overflow' in memory like you thought.

提交回复
热议问题