summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-07-05 21:46:01 +0000
committernoloader <noloader@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2015-07-05 21:46:01 +0000
commitfc564ea5f964d6fc0bc13a0ca83451cf4ac57b75 (patch)
treee8357405744d8d12aab210bdc808bd66350e5cc0
parentb1e1b4250451d45673c5f5ca895c59103586d3fa (diff)
downloadcryptopp-fc564ea5f964d6fc0bc13a0ca83451cf4ac57b75.tar.gz
Guarded COUNTOF macro. Thanks to Graham Bull for the suggestion
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@571 57ff6487-cd31-0410-9ec3-f628ee90f5f0
-rw-r--r--misc.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/misc.h b/misc.h
index 303c29c..b6a1b86 100644
--- a/misc.h
+++ b/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)
-# define COUNTOF(x) _countof(x)
-#else
-# define COUNTOF(x) (sizeof(x)/sizeof(x[0]))
-#endif
+#ifndef COUNTOF
+# if defined(_MSC_VER) && (_MSC_VER >= 1400)
+# define COUNTOF(x) _countof(x)
+# else
+# define COUNTOF(x) (sizeof(x)/sizeof(x[0]))
+# endif
+#endif // COUNTOF
// ************** misc classes ***************