Is using unsigned integer overflow good practice?

后端 未结 12 517
耶瑟儿~
耶瑟儿~ 2020-12-01 15:55

I was reading the C Standard the other day, and noticed that unlike signed integer overflow (which is undefined), unsigned integer overflow is well defined. I\'ve seen it us

12条回答
  •  自闭症患者
    2020-12-01 16:58

    To put it shortly:

    It is perfectly legal/OK/safe to use unsigned integer overflow as you see fit as long as you pay attention and adhere to the definition (for whatever purpose - optimization, super clever algorithms, etc.)

提交回复
热议问题