问题描述
我知道无符号整数数据类型是造成大多数b / b
虚假警告信息的原因,但我并没有意识到它们是一个安全
风险(参见此处
。全部为一个
可能会多加一点。
那么C ++是否有时间弃用无符号整数类型?
john
I knew that unsigned integral data types were the cause of scads of mostly
spurious warning messages, but I didn''t realise that they were a security
risk too (see here
http://www.securitytracker.com/alert.../1009067.html). All for one
measly extra bit.
So has the time come for C++ to deprecate unsigned integral types?
john
推荐答案
实际上它看起来只是相反的问题。如果计算是
全部未签名,则不会有问题。
Actually it looks like just the opposite problem. If the calculation was
all unsigned, it wouldn''t be a problem.
你不要不要弃用功能,因为有些人太不能使用它们
正确。如果你这样做了,你也会删除指针,引用,副作用和
别名等等,最后会得到一种完全不同的语言,这可能会让你看起来像b $ b。很像ML。 C ++是一种电动工具,需要与
适当的谨慎和培训一起使用。任何编程错误都是
程序员的错,而不是语言。
Claudio Puviani
You don''t deprecate features because some people are too incompetent to use them
correctly. If you did, you''d also remove pointers, references, side-effects and
aliasing, etc. and end up with a completely different language that would
probably look a lot like ML. C++ is a power tool and needs to be used with the
appropriate caution and training. Any programming error is the fault of the
programmer, not the language.
Claudio Puviani
news:c0 ************* @ ID-196037.news.uni-berlin.de ...
news:c0*************@ID-196037.news.uni-berlin.de...
实际上它看起来就像是相反的问题。如果计算结果全部未签名,则不会有问题。
Actually it looks like just the opposite problem. If the calculation was
all unsigned, it wouldn''t be a problem.
如果全部是int,那么它也不是问题,问题是
两者的混合以及可能导致的溢出。由于我不认为有人建议删除已签名的整数,所以我建议我们放弃
无符号。除了字符类型外。
john
If it was all int it wouldn''t be an issue either, the problem is the mix of
the two and the overflows that can result. Since I don''t guess anyone is
proposing to remove signed integers, I''m proposing that we should drop
unsigned. Except maybe for character types.
john
这篇关于是时候摆脱未签名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!