c# – 为什么unsigned int不符合CLS?

为什么无符号整数不符合CLS?

我开始认为类型规范只是为了性能,而不是正确性。

不是所有的语言都有unsigned int的概念。例如VB 6没有unsigned int的概念,我怀疑VB7 / 7.1的设计者的决定不能实现(它现在在VB8中实现)。

去引用:

07000

The CLS was designed to be large enough to include the language
constructs that are commonly needed by developers, yet small enough
that most languages are able to support it. In addition, any language
construct that makes it impossible to rapidly verify the type safety
of code was excluded from the CLS so that all CLS-compliant languages
can produce verifiable code if they choose to do so.

更新:我几年前回想起来,虽然我不明白为什么UInt不会是类型安全可验证的,我想CLS的家伙们必须有一个截止点,什么是基线最小支持的值类型数。另外,当你想到更长的时间越来越多的语言被移植到CLR为什么迫使他们实现无符号整数获得CLS合规性,如果绝对没有概念,永远?

http://stackoverflow.com/questions/6325/why-are-unsigned-ints-not-cls-compliant

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:c# – 为什么unsigned int不符合CLS?