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
Remove references to pointers within the standard where appropriate. (#678)
- They're still present in the grammar, and in explanatory
paragraphs after relevant grammar sections.
- There are references in Annexes B and D, but that feels reasonable.
Fixes#676.
@@ -441,8 +441,6 @@ The value type constraint specifies that a type argument used for the type param
441
441
442
442
> *Note*: The `System.Nullable<T>` type specifies the non-nullable value type constraint for `T`. Thus, recursively constructed types of the forms `T??` and `Nullable<Nullable<T>>` are prohibited. *end note*
443
443
444
-
Pointer types are never allowed to be type arguments and are not considered to satisfy either the reference type or value type constraints.
445
-
446
444
If a constraint is a class type, an interface type, or a type parameter, that type specifies a minimal “base type” that every type argument used for that type parameter shall support. Whenever a constructed type or generic method is used, the type argument is checked against the constraints on the type parameter at compile-time. The type argument supplied shall satisfy the conditions described in [§8.4.5](types.md#845-satisfying-constraints).
447
445
448
446
A *class_type* constraint shall satisfy the following rules:
@@ -566,7 +564,6 @@ The ***dynamic erasure*** of a type `C` is type `Cₓ` constructed as follows:
566
564
-If `C` isanestedtype `Outer.Inner` then `Cₓ` isanestedtype `Outerₓ.Innerₓ`.
567
565
- If `C` `Cₓ`isaconstructedtype `G<A¹, ..., Aⁿ>` withtypearguments `A¹, ..., Aⁿ` then `Cₓ` istheconstructedtype `G<A¹ₓ, ..., Aⁿₓ>`.
568
566
-If `C` isanarraytype `E[]` then `Cₓ` isthearraytype `Eₓ[]`.
569
-
-If `C` isapointertype `E*` then `Cₓ` isthepointertype `Eₓ*`.
Copy file name to clipboardExpand all lines: standard/expressions.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2598,7 +2598,7 @@ class __Anonymous1
2598
2598
}
2599
2599
```
2600
2600
2601
-
where each «Tx» is the type of the corresponding expression «ex». The expression used in a *member_declarator* shall have a type. Thus, it is a compile-time error for an expression in a *member_declarator* to be `null` or an anonymous function. It is also a compile-time error for the expression to have a pointer type ([§22.3](unsafe-code.md#223-pointer-types)).
2601
+
where each «Tx» is the type of the corresponding expression «ex». The expression used in a *member_declarator* shall have a type. Thus, it is a compile-time error for an expression in a *member_declarator* to be `null` or an anonymous function.
2602
2602
2603
2603
The names of an anonymous type and of the parameter to its `Equals` method are automatically generated by the compiler and cannot be referenced in program text.
Copy file name to clipboardExpand all lines: standard/unsafe-code.md
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ The type specified before the `*` in a pointer type is called the ***referent ty
130
130
131
131
A *pointer_type* may only be used in an *array_type* in an unsafe context ([§22.2](unsafe-code.md#222-unsafe-contexts)). A *non_array_type* is any type that is not itself an *array_type*.
132
132
133
-
Unlike references (values of reference types), pointers are not tracked by the garbage collector—the garbage collector has no knowledge of pointers and the data to which they point. For this reason a pointer is not permitted to point to a reference or to a struct that contains references, and the referent type of a pointer shall be an *unmanaged_type*.
133
+
Unlike references (values of reference types), pointers are not tracked by the garbage collector—the garbage collector has no knowledge of pointers and the data to which they point. For this reason a pointer is not permitted to point to a reference or to a struct that contains references, and the referent type of a pointer shall be an *unmanaged_type*. Pointer types themselves are unmanaged types, so a pointer type may be used as the referent type for another pointer type.
134
134
135
135
The intuitive rule for mixing of pointers and references is that referents of references (objects) are permitted to contain pointers, but referents of pointers are not permitted to contain references.
136
136
@@ -170,8 +170,16 @@ A *pointer_type* cannot be used as a type argument ([§8.4](types.md#84-construc
Thedefaultvalue ([§9.3](variables.md#93-default-values)) for any pointer type is `null`.
182
+
175
183
> *Note*: Although pointers can be passed as `ref` or `out` parameters, doing so can cause undefined behavior, since the pointer might well be set to point to a local variable that no longer exists when the called method returns, or the fixed object to which it used to point, is no longer fixed. For example:
0 commit comments