From: Matthias Kruk Date: Fri, 13 Mar 2020 16:48:42 +0000 (+0900) Subject: Add sizeof_a() convenience macro for determining the number of elements in a static... X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=d9281ee44b14d45baa71ec79afc1d80104e00ad1;p=corax Add sizeof_a() convenience macro for determining the number of elements in a static array --- diff --git a/include/corax/types.h b/include/corax/types.h index 119dfe1..eb09fbf 100644 --- a/include/corax/types.h +++ b/include/corax/types.h @@ -43,4 +43,6 @@ typedef long long off_t; #define UID_ROOT ((uid_t)0) #define GID_ROOT ((gid_t)0) +#define sizeof_a(_a) (sizeof(_a) / sizeof(_a[0])) + #endif /* __TYPES_H */