为什么unsigned int类型的不符合CLS? [英] Why are unsigned int's not CLS compliant?

查看:251
本文介绍了为什么unsigned int类型的不符合CLS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Why are unsigned integers not CLS compliant?

我开始觉得类型规范仅仅是性能,而不是其正确性。

I am starting to think the type specification is just for performance and not for correctness.

推荐答案

不是所有的语言都无符号整数的概念。例如VB 6例无符号整数,我怀疑开车VB7 / 7.1的设计人员决定不执行,以及(它在VB8现在已经实现)。

Not all languages have the concept of unsigned ints. For example VB 6 had no concept of unsigned ints which I suspect drove the decision of the designers of VB7/7.1 not to implement as well (it's implemented now in VB8).

要报价:

<一个href="http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx">http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx

CLS的被设计成足够大以包括在语言   这通常需要开发人员,但足够小结构   大多数语言都能够支持。此外,任何语言   构造,使得它不可能快速验证的类型安全   $的C $ c的排除在CLS,使所有符合CLS的语言   能产生可核实code,如果他们选择这样做。

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遵从性,如果没有绝对的概念,永远?

Update: I did wonder about this some years back, and whilst I can't see why a UInt wouldn't be type safety verifiable, I guess the CLS guys had to have a cut off point somewhere as to what would be the baseline minimum number of value types supported. Also when you think about the longer term where more and more languages are being ported to the CLR why force them to implement unsigned ints to gain CLS compliance if there is absolutely no concept, ever?

这篇关于为什么unsigned int类型的不符合CLS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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