utils/macros.h (N): Properly parenthesize the argument.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 15 Jul 2018 18:26:55 +0000 (19:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 15 Jul 2018 18:26:55 +0000 (19:26 +0100)
WTF?  How did I write this wrong?

Fortunately, I don't think it actually matters.  The argument must have
array type.  Postfix operators are higher precedence, so that's not a
problem; prefix operators are in the right place already; and binary
operators don't yield array types.

utils/macros.h

index bcceecd..8f9f49e 100644 (file)
@@ -40,7 +40,7 @@
 
 /*----- Miscellaneous utility macros --------------------------------------*/
 
-#define N(v) (sizeof(v)/sizeof(*v))
+#define N(v) (sizeof(v)/sizeof(*(v)))
 
 #define MLIB__STR(x) #x
 #define STR(x) MLIB__STR(x)