Changes between Version 107 and Version 108 of IR2
- Timestamp:
- 05/20/21 09:29:59 (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
IR2
v107 v108 322 322 Notes 323 323 324 A heap is an abstraction for a set of objects of possibly different types which can be referenced by pointers. A C statement that mallocs 10 ints, e.g.,324 A heap is an abstraction for a set of objects of possibly different types which can be referenced by pointers. `$alloc` adds an object to the heap and returns a pointer to that object. The object can then be read or modified using the pointer. Example: C code that mallocs 10 ints 325 325 {{{ 326 326 int * p = malloc(10*sizeof(int)); … … 335 335 336 336 More generally, if the type of objects being malloced is not known, or changes dynamically, one could define a general "object" type... 337 {{{ 338 struct $object { 339 $int size; // in bytes 340 $map<$int,$any> data; // byte offset -> element 341 } 342 typedef struct $object $object; 343 }}} 344 But this requires `$any` ... (think about this) ... 345 337 346 338 347 === bundle.cvh ===
