Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak numeric IntPtr spec #6167

Merged
merged 3 commits into from
May 26, 2022
Merged

Tweak numeric IntPtr spec #6167

merged 3 commits into from
May 26, 2022

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented May 25, 2022

@cston @tannergooding for review.

Closes #4385

@jcouv jcouv requested a review from a team as a code owner May 25, 2022 23:13
@jcouv jcouv self-assigned this May 25, 2022
### 22.6.4 Pointer element access

\[...]
In a pointer element access of the form `P[E]`, `P` shall be an expression of a pointer type other than `void*`, and `E` shall be an expression that can be implicitly converted to `int`, `uint`, **`nint`, `nuint`,** `long`, or `ulong`.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tannergooding This differs from your proposal. I wasn't sure why you had nint behaving differently than int:

Array elements are accessed using element_access expressions (Array access) of the form A[I1, I2, ..., In], where A is an expression of an array type and each Ix is an expression of type nint, nuint, or of a type implicitly convertible to int, uint, long, or ulong.

[...]
T* operator +(nint x, T* y);
T* operator +(nuint x, T* y);
```
Copy link
Member

@cston cston May 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T* operator +(T* x, nint y);
T* operator +(T* x, nuint y);
...

@jcouv jcouv requested a review from cston May 26, 2022 01:25
@jcouv jcouv merged commit de7cd83 into dotnet:main May 26, 2022
@jcouv jcouv deleted the nint-tweaks branch May 26, 2022 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal]: First class native integer support
2 participants