Overflowing of Unsigned Int

前端 未结 3 1394
死守一世寂寞
死守一世寂寞 2020-11-28 12:43

What will the unsigned int contain when I overflow it? To be specific, I want to do a multiplication with two unsigned ints: what will be in the

3条回答
  •  执笔经年
    2020-11-28 13:25

    Unsigned integer overflow, unlike its signed counterpart, exhibits well-defined behaviour.

    Values basically "wrap" around. It's safe and commonly used for counting down, or hashing/mod functions.

提交回复
热议问题