是使用无符号整数溢出好的做法呢? [英] Is using unsigned integer overflow good practice?

查看:155
本文介绍了是使用无符号整数溢出好的做法呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是读C标准的一天,并注意到不同符号整数溢出(这是不确定的),无符号整数溢出是明确界定。我已经看到了它在许多code为最大值,等使用,但鉴于有关溢出巫毒教,这被认为是良好的编程习惯?它是无论如何不安全?我知道,很多现代语言如Python都不支持它 - 相反,他们继续延长大量的大小。

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 used in a lot of code for maximums, etc. but given the voodoos about overflow, is this considered good programming practice? Is it in anyway insecure? I know that a lot of modern languages like Python do not support it- instead they continue to extend the size of large numbers.

推荐答案

无符号整数溢出(在环绕的形状),哈希函数是经常采取的优势,并已自今年点。

Unsigned integer overflow (in the shape of wrap-around) is routinely taken advantage of in hashing functions, and has been since the year dot.

这篇关于是使用无符号整数溢出好的做法呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆