[Version 11.0] Feature support for Numeric IntPtr#1598
Draft
RexJaeschke wants to merge 4 commits intodraft-v11from
Draft
[Version 11.0] Feature support for Numeric IntPtr#1598RexJaeschke wants to merge 4 commits intodraft-v11from
RexJaeschke wants to merge 4 commits intodraft-v11from
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is Rex's adaptation of the corresponding MS proposal.
Issue 1
Since .NET 5,
IntPtrandUIntrPtrhave had propertiesMinValueandMaxValue. Shall we admit that and add these members to the library annex as new members of an existing type?Issue 2
Should we add any new operators (such as addition and subtraction) to
IntPtr/UIntPtrin the library annex?Issue 3
The following text was added to 8.3.5 Simple types in Rex's Draft V9 PR #1457. Please review it to see which text should be kept, which should be deleted, and which should be changed.
Although
nintandnuintshall be represented by the typesSystem.IntPtrandSystem.UIntPtr, respectively,nintandnuintare not aliases for those types. As such, not all members of the correspondingSystemtypes are defined fornintandnuint. Instead, the compiler shall make available additional conversions and operations for the typesSystem.IntPtrandSystem.UIntPtr, when used in the context of native integer types.Consider the following:
While the implementation provides operations and conversions for
nintandnuintthat are appropriate for integer types, those operations and conversions are not available on theSystemtype counterparts. Similarly,The only constructor for
nintornuintis the parameter-less constructor.The following members of
System.IntPtrandSystem.UIntPtrare explicitly excluded fromnintornuint:The remaining members of
System.IntPtrandSystem.UIntPtrare implicitly included innintandnuint. These are:Interfaces implemented by
System.IntPtrandSystem.UIntPtrare implicitly included innintandnuint, with occurrences of the underlying types replaced by the corresponding native integer types. For example, ifIntPtrimplementsISerializable,IEquatable<IntPtr>, andIComparable<IntPtr>, thennintimplementsISerializable,IEquatable<nint>, andIComparable<nint>.nintandSystem.IntPtr, andnuintandSystem.UIntPtr, are considered equivalent for overriding, hiding, and implementing, however.Overloads cannot differ by
nintandSystem.IntPtr, andnuintandSystem.UIntPtr, alone. However, overrides and implementations may differ bynintandSystem.IntPtr, ornuintandSystem.UIntPtr, alone.Methods hide other methods that differ by
nintandSystem.IntPtr, ornuintandSystem.UIntPtr, alone.typeof(nint)istypeof(System.IntPtr), andtypeof(nuint)istypeof(System.UIntPtr).[