[11585] Add countof macro

It can be used to calculate number of elements in static array. Do not use with pointers!
This commit is contained in:
zergtmn 2011-06-01 16:23:01 +06:00
parent 3788348b46
commit 4c81559800
3 changed files with 9 additions and 5 deletions

View file

@ -250,4 +250,8 @@ inline char * mangos_strdup(const char * source)
# define M_PI_F float(M_PI)
#endif
#ifndef countof
#define countof(array) (sizeof(array) / sizeof((array)[0]))
#endif
#endif