Changes between Version 3 and Version 4 of Pointers
- Timestamp:
- 09/15/13 10:05:04 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Pointers
v3 v4 63 63 A type pointer-to-T1-in-s can be cast to a type pointer-to-T2-in-s according to the usual rules of C (or whatever variation is used in CIVL-C). In other words, usual casting rules apply as long as you don't change the scope. 64 64 65 == Parameterized typedefs ==65 == Scope-parameterized types == 66 66 67 67 typedefs can be parameterized by scopes, e.g. … … 86 86 <s1,s2,s3> typedef struct ... 87 87 }}} 88 89 Structs can also be parameterized by scopes: 90 91 {{{ 92 <s> struct Node { 93 int id; 94 Node<s> *<s> next; 95 } 96 97 void f() { 98 $scope s1; 99 struct Node<s1> u, v; 100 u.id = 0; 101 u.next = &v; 102 v.id = 1; 103 v.next = NULL; 104 } 105 }}} 106 107 If you want to combine a typedef and struct definition where both are parameterized, you have to break it up into two steps: 108 109 {{{ 110 <s> struct _Node { … } 111 <s> typedef struct _Node<s> Node; 112 }}} 113 88 114 89 115 == Parameterized procedures ==
