Changes between Version 18 and Version 19 of PIL
- Timestamp:
- 10/16/24 13:17:47 (19 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PIL
v18 v19 29 29 30 30 == Types 31 - '''type names''' are used for all declarations. There are no C declarators. Examples: 31 32 === Basic properties of types 33 34 '''type names''' are used for all declarations. There are no C declarators. Examples: 32 35 * `$int[] a`: declares `a` to be an array of integer 33 36 * `$int* p`: pointer to integer … … 35 38 * `$int[]* q`: pointer to array of integer 36 39 * `$int*[]($real) f`: function from Real to array of pointer to integer 37 - every type has a default value. The result of evaluating an erroneous expression is the default value of that type. (But as explained above, an analyzer may check for all errors.) 40 41 Type definitions have the form: `typedef typename ID;`. 42 43 Every type has a default value. The result of evaluating an erroneous expression is the default value of that type. (But as explained above, an analyzer may check for all errors.) 44 45 === The types 46 38 47 - basic types: 39 48 * `$bool` : the set consisting of `$true` and `$false`. Default value: `$false`. … … 52 61 - `$map<T1,T2>` : finite map from `T1` to `T2`. A map is a set of ordered pairs `(x,y)` with the property that if `(x,y)` and `(x,z)` are in the map, then `y`=`z`. Default value: the empty map. 53 62 - `$tuple<T1,...>` : tuples of specified type. This is similar to `struct`, but there is no tag and the fields do not have names. Default value: the tuple in which each component has its default value. 54 - Type definitions have the form: `typedef typename ID;` 63 - `$obj` : the object type. This is a type for representing a sequence of bytes holding arbitrary values at different intervals. It is used to model C objects, such as the object created by a call to C's `malloc`. 64 65 === Sized types 66 67 The types above are the ''unsized types'' A ''sized type'' comprises an unsized type and a positive integer, which represents the size of the type in bytes. Syntactically, a sized type is specified 68 {{{ 69 $size(expr) typename 70 }}} 71 where expr is an integer constant expression and typename is the name of an unsized type. For example, 72 {{{ 73 typedef $size(4) $int int; 74 typedef $size(8) $int long; 75 typedef $size(4) $real float; 76 typedef $size(8) $real double; 77 }}} 78 defines 4 distinct types. Certain operations require a sized type. 79 55 80 56 81 == Functions … … 289 314 * frees the object referred to by `p`, the pointer returned by an earlier call to `$new` or `$alloc`. 290 315 316 == Objects 317 318 The following operations are supported on the `$obj` type: 319 320 321 291 322 292 323 == Questions
