Guarded COUNTOF macro. Thanks to Graham Bull for the suggestion
parent
aa8bb8c5cd
commit
8386b3f139
8
misc.h
8
misc.h
|
|
@ -72,11 +72,13 @@ struct CompileAssert
|
|||
|
||||
// ************** counting elements in an array ***************
|
||||
// VS2005 added _countof macro, fails on pointers
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
#ifndef COUNTOF
|
||||
# if defined(_MSC_VER) && (_MSC_VER >= 1400)
|
||||
# define COUNTOF(x) _countof(x)
|
||||
#else
|
||||
# else
|
||||
# define COUNTOF(x) (sizeof(x)/sizeof(x[0]))
|
||||
#endif
|
||||
# endif
|
||||
#endif // COUNTOF
|
||||
|
||||
// ************** misc classes ***************
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue