Skip to content

astatic

Category: array
GitHub: cute_array.h


Creates an array with an initial static storage backing. Will grow onto the heap if the size becomes too large.

#define astatic(a, buffer, buffer_size) cf_array_static(a, buffer, buffer_size)
Parameters Description
a The array. Can be NULL.
buffer An initial buffer of memory to store the array within.
buffer_size The size of buffer in bytes.

Return Value

Returns a pointer to a. a will automatically be reassigned to any new pointer.

Remarks

This macro is useful as an optimization to avoid any dynamic memory allocation in the common case for implementing certain data structures (such as strings or stack vectors). As the array grows too large for the buffer it will dynamically grow into the heap.

dyna
asize
acount
acap
afit
apush
apop
aend
alast
aclear
aset
arev
ahash
adel
afree