dyna¶
Category: array
GitHub: cute_array.h
An empty macro used in the C API to markup dynamic arrays.
Code Example¶
Creating a dynamic array, pushing some elements into the array, and freeing it up afterwards.
dyna int a = NULL;
apush(a, 5);
CF_ASSERT(alen(a) == 1);
alen(a)--;
CF_ASSERT(alen(a) == 0);
afree(a);
Remarks¶
This is an optional and completely empty macro. It's only purpose is to provide a bit of visual indication a type is a dynamic array. One downside of the C-macro API is the opaque nature of the pointer type. Since the macros use polymorphism on typed pointers, there's no actual array struct type. It can get really annoying to sometimes forget if a pointer is an array, a hashtable, or just a pointer. This macro can be used to markup the type to make it much more clear for function parameters or struct member definitions. It's saying "Hey, I'm a dynamic array!" to mitigate this downside.
Related Pages¶
afree
asize
acount
acap
afit
apush
apop
aend
alast
aclear
aset
arev
ahash
adel
astatic