| 318 | | The following operations are supported on the `$obj` type: |
| 319 | | |
| | 318 | The function |
| | 319 | - `$obj $empty_obj($int size);` |
| | 320 | returns the empty object spanning `size` bytes. Only values of a sized type can be written to an object. |
| | 321 | |
| | 322 | An object is modified through a pointer into the object, for example: |
| | 323 | {{{ |
| | 324 | typedef $size(4) $int int; |
| | 325 | typedef $size(8) $real double; |
| | 326 | $obj o1 = $empty_obj(1000); |
| | 327 | double* dp = (double*)&o1; // points to byte 0 |
| | 328 | *dp = 3.14; |
| | 329 | *(dp+7) = 2.718; |
| | 330 | int* ip = (int*)&o1; |
| | 331 | *(ip+2) = 17; |
| | 332 | }}} |
| | 333 | The operations above place the double value 3.14 in o1 at positions 0..7, the double value 2.718 at positions 28..35, and the integer value 17 at positions 8..11. |
| | 334 | |
| | 335 | If a write to an object overlaps the interval of an existing value, the old value is removed. |
| | 336 | |
| | 337 | The values in an object are also read using pointers. |