Next: , Previous: Dynamic arrays, Up: Dynamic arrays


12.1 An overview of the darray type

A dynamic array is stored in a ‘struct darray’, with a ‘typedef’ name of ‘Darray’. The members of this structure are private. A darray parametrises the stored objects by ‘sizeof’; the size of the objects to be stored must be specified when initialising a darray. Objects themselves are passed by generic pointers, ‘void *’. Indices in the array have type ‘ssize_t’ and are zero-based; an `index' of -1 is an out-of-band value used to indicate `no such position' or an error return.

All the ‘Darray’ functions are declared in libretto/darray.h.