You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- A *constant_expression* oftype `long` canbeconvertedtotype `ulong`, providedthevalueofthe*constant_expression*isnotnegative.
327
327
328
328
Therangeforconstantsoftype `nint` isthesamerangeas `int`, andtherangefor constants of type `nuint` is the same range as `uint` ([§12.25](expressions.md#1225-constant-expressions)).
Copy file name to clipboardExpand all lines: standard/expressions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -297,7 +297,7 @@ When overload resolution rules ([§12.6.4](expressions.md#1264-overload-resoluti
297
297
298
298
**This subclause is informative.**
299
299
300
-
Unary numeric promotion occurs for the operands of the predefined `+`, `-`, and `~` unary operators. Unary numeric promotion simply consists of converting operands of type `sbyte`, `byte`, `short`, `ushort`, or `char` to type `int`. Additionally, for the unary - operator, unary numeric promotion converts operands of type `uint` or `nint` to type `long`.
300
+
Unary numeric promotion occurs for the operands of the predefined `+`, `-`, and `~` unary operators. Unary numeric promotion simply consists of converting operands of type `sbyte`, `byte`, `short`, `ushort`, or `char` to type `int`. Additionally, for the unary `-` operator, unary numeric promotion converts operands of type `uint` or `nint` to type `long`.
301
301
302
302
**End of informative text.**
303
303
@@ -7055,7 +7055,7 @@ A constant expression may be either a value type or a reference type. If a const
7055
7055
- have a value of `null`; or
7056
7056
- be a default value expression ([§12.8.21](expressions.md#12821-default-value-expressions)) of reference type.
7057
7057
7058
-
A *constant_expression* of type `nint` shall have a value in the range \[`int.MinValue`,`int.MaxValue`\]. A *constant_expression* of type `nuint` shall have a value in the range \[`uint.MinValue`,`uint.MaxValue`\].
7058
+
A *constant_expression* of type `nint` shall have a value in the range \[-2147483648, 2147483647\]. A *constant_expression* of type `nuint` shall have a value in the range \[0, 4294967295\].
7059
7059
7060
7060
Only the following constructs are permitted in constant expressions:
Although`nint` and `nuint` arerepresentedbythetypes `System.IntPtr` and `System.UIntPtr`, respectively, `nint` and`nuint` are *not* aliasesforthosetypes. Thereisanidentityconversion ([§10.2.2](conversions.md#1022-identity-conversion)) between `nint` and `System.IntPtr`, andbetween `nuint` and `System.UIntPtr`.
324
+
Thetypes`nint` and `nuint` arerepresentedbythetypes `System.IntPtr` and `System.UIntPtr`, respectively, andare *not* aliasesforthesetypes. Inthiscontextbeing *representedby* means:
326
325
327
-
Thelanguageprovidesconversions ([§10.2](conversions.md#102-implicit-conversions)), unaryoperators ([§12.9](expressions.md#129-unary-operators)), andbinaryoperators ([§12.12](expressions.md#1212-arithmetic-operators)) for `nint` and `nuint` thatareappropriateforintegraltypes. Theseoperatorsfollowthesamepatternsasthecorrespondingoperatorsfor `int`/`long` and `uint`/`ulong`.
328
-
329
-
> *Note*: Operationsperformedthrough `dynamic` bindingon `System.IntPtr` and `System.UIntPtr` valuesdonothaveaccesstothe `nint` and `nuint` operators. *endnote*
330
-
331
-
`sizeof(nint)` and `sizeof(nuint)` returnthesizeofanativeinteger ([§23.6.9](unsafe-code.md#2369-the-sizeof-operator)).
332
-
333
-
`typeof(nint)` is `typeof(System.IntPtr)`, and `typeof(nuint)` is `typeof(System.UIntPtr)`.
`nint` and `System.IntPtr`, and `nuint` and `System.UIntPtr`, areconsideredequivalentforoverriding, hiding, andimplementing.
339
-
340
-
Overloadscannotdifferby `nint` and `System.IntPtr`, orby `nuint` and `System.UIntPtr`, alone. However, overridesandimplementationsmaydifferby `nint` and `System.IntPtr`, orby `nuint` and `System.UIntPtr`, alone.
341
-
342
-
Methodshideothermethodsthatdifferby `nint` and `System.IntPtr`, orby `nuint` and `System.UIntPtr`, alone.
326
+
- Theonlymembersdirectlyaccessiblefor `nint` and `nuint` aretherequiredmethodsof `Object` ([§C.2](standard-library.md#c2-standard-library-types-defined-in-isoiec-23271)). AnyothermembersofSystem.IntPtr` and `System.UIntPtr` maybeaccessedviathosetypes.
327
+
- Operationsperformedthrough `dynamic` bindingon `System.IntPtr` and `System.UIntPtr` valuesdonothaveaccesstothe `nint` and `nuint` operators.
328
+
- Inallotherrespects `nint` and `nuint` behaveasiftheyarealiasesof `System.IntPtr` and `System.UIntPtr`.
0 commit comments