<p>Why are unsigned integers not CLS compliant?</p>

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

[{'answer_id': 6333, 'author': 'Kev', 'author_id': 419, 'author_profile': 'https://Stackoverflow.com/users/419', 'pm_score': 8, 'selected': True, 'text': '<p>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).</p>\n<p>To quote:</p>\n<blockquote>\n<p><a href="http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/12a7a7h3.aspx</a></p>\n<p>The CLS was designed to be large enough to include the language\nconstructs that are commonly needed by developers, yet small enough\nthat most languages are able to support it. In addition, any language\nconstruct that makes it impossible to rapidly verify the type safety\nof code was excluded from the CLS so that all CLS-compliant languages\ncan produce verifiable code if they choose to do so.</p>\n</blockquote>\n<p>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?</p>\n'}, {'answer_id': 6337, 'author': 'Bryan Roth', 'author_id': 299, 'author_profile': 'https://Stackoverflow.com/users/299', 'pm_score': 3, 'selected': False, 'text': "<p>Unsigned integers are not CLS compliant because they're not interoperable between certain languages.</p>\n"}, {'answer_id': 3659048, 'author': 'Ian Ringrose', 'author_id': 57159, 'author_profile': 'https://Stackoverflow.com/users/57159', 'pm_score': 3, 'selected': False, 'text': "<p>Unsigned int's don't gain you that much in real life, however having more than 1 type of int gives you pain, so a lot of languages only have singed ints.</p>\n\n<p>CLS compliant is aimed at allowing a class to be made use of from lots of languages…</p>\n\n<p><strong>Remember that no one makes you be CLS compliant.</strong></p>\n\n<p>You can still use unsigned ints <strong>within</strong> a method, or as parms to a <strong>private</strong> method, as it is only the public API that CLS compliant restricts.</p>\n"}, {'answer_id': 23984090, 'author': 'supercat', 'author_id': 363751, 'author_profile': 'https://Stackoverflow.com/users/363751', 'pm_score': 5, 'selected': False, 'text': '<p>Part of the issue, I suspect, revolves around the fact that unsigned integer types in C are required to behave as members of an abstract algebraic ring rather than as numbers [meaning, for example, that if an unsigned 16-bit integer variable equals zero, decrementing it is <em>required</em> to yield 65,535, and if it\'s equal to 65,535 then incrementing it is required to yield zero.]  There are times when such behavior is extremely useful, but numeric types exhibit such behavior may have gone against the spirit of some languages.  I would conjecture that the decision to omit unsigned types probably predates the decision to support both checked and unchecked numeric contexts.  Personally, I wish there had been separate integer types for unsigned numbers and algebraic rings; applying a unary minus operator to unsigned 32-bit number should yield a 64-bit signed result [negating anything other than zero would yield a negative number] but applying a unary minus to a ring type should yield the additive inverse within that ring.</p>\n\n<p>In any case, the reason unsigned integers are not CLS compliant is that Microsoft decided that languages didn\'t have to support unsigned integers in order to be considered "CLS compatible".</p>\n'}]
['https://Stackoverflow.com/questions/6325', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/56/']