--- a/src/cx/common.h Tue Oct 22 22:20:50 2024 +0200 +++ b/src/cx/common.h Tue Oct 22 22:42:48 2024 +0200 @@ -117,6 +117,16 @@ void * ); +/** + * Determines the number of members in a static C array. + * + * @attention never use this to determine the size of a dynamically allocated + * array. + * + * @param arr the array identifier + * @return the number of elements + */ +#define cx_nmemb(arr) (sizeof(arr)/sizeof((arr)[0])) // Compiler specific stuff