| 78 | | defines 4 distinct types. Certain operations require a sized type. |
| | 79 | defines 5 distinct types. Certain operations require a sized type. |
| | 80 | |
| | 81 | Restrictions on sized types: |
| | 82 | - an array type cannot be sized |
| | 83 | - the type `$obj` cannot be sized |
| | 84 | - if a struct type is sized and all of its fields have sized types then the size of the struct |
| | 85 | must be the sum of the sizes of the fields |
| | 86 | - if a union type is sized then the size of the union must be greater than or equal to the |
| | 87 | size of any sized type field |
| | 88 | |
| | 89 | Note on translation from C: C structs can have "padding" after each field. This can be modeled |
| | 90 | in PIL by making the padding explicit, e.g., |
| | 91 | {{{ |
| | 92 | struct Pair { |
| | 93 | int i; |
| | 94 | char[2] _padding1; |
| | 95 | double x; |
| | 96 | char[4] _padding2; |
| | 97 | }}} |
| | 98 | |
| | 99 | Except... you can do things like `char[2]` in PIL, hmmm, have to think about this. |