diff --git a/include/compiler.h b/include/compiler.h
index 006170035f692eeb5bc6ddc0f1f0f506850bc25c..aeb27dd3cb4101790508406d4396b802f95701d2 100644
--- a/include/compiler.h
+++ b/include/compiler.h
@@ -35,6 +35,15 @@
 #define likely(x)      __builtin_expect(!!(x), 1)
 #define unlikely(x)    __builtin_expect(!!(x), 0)
 
+/**
+ *
+ * ARRAY_SIZE - get the number of elements in a visible array
+ * @param x the array whose size you want
+ *
+ * This does not work on pointers, or arrays declared as [], or
+ * function parameters.  With correct compiler support, such usage
+ * will cause a build error
+ */
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
diff --git a/lib/cmp_io.c b/lib/cmp_io.c
index 8f511e614373b4fda0c8b84ebf20436f697ecddc..3aba7b29e3a423bfab1d2236e00414a56b9ae49f 100644
--- a/lib/cmp_io.c
+++ b/lib/cmp_io.c
@@ -25,7 +25,10 @@
 #include <ctype.h>
 #include <sys/stat.h>
 
+
 #include <cmp_tool-config.h>
+#include <compiler.h>
+
 #include <cmp_io.h>
 #include <cmp_support.h>
 #include <rdcu_cmd.h>
@@ -416,7 +419,7 @@ enum cmp_data_type string2data_type(const char *data_type_str)
 		if (isalpha(data_type_str[0])) {  /* check if mode is given as text */
 			size_t j;
 
-			for (j = 0; j < sizeof(data_type_string_table) / sizeof(data_type_string_table[0]); j++) {
+			for (j = 0; j < ARRAY_SIZE(data_type_string_table); j++) {
 				if (!strcmp(data_type_str, data_type_string_table[j].str)) {
 					data_type = data_type_string_table[j].data_type;
 					break;
@@ -449,7 +452,7 @@ const char *data_type2string(enum cmp_data_type data_type)
 	size_t j;
 	const char *string = "DATA_TYPE_UNKNOWN";
 
-	for (j = 0; j < sizeof(data_type_string_table) / sizeof(data_type_string_table[0]); j++) {
+	for (j = 0; j < ARRAY_SIZE(data_type_string_table); j++) {
 		if (data_type == data_type_string_table[j].data_type) {
 			string = data_type_string_table[j].str;
 			break;
@@ -495,7 +498,7 @@ int cmp_mode_parse(const char *cmp_mode_str, enum cmp_mode *cmp_mode)
 		return -1;
 
 	if (isalpha(cmp_mode_str[0])) {  /* check if mode is given as text */
-		for (j = 0; j < sizeof(conversion) / sizeof(conversion[0]); ++j) {
+		for (j = 0; j < ARRAY_SIZE(conversion); j++) {
 			if (!strcmp(cmp_mode_str, conversion[j].str)) {
 				*cmp_mode = conversion[j].cmp_mode;
 				return 0;