On 9/18/2023 2:24 PM, KP Singh wrote: > [...] > +#define __COUNT_COMMAS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _n, X...) _n > +#define COUNT_COMMAS(a, X...) __COUNT_COMMAS(, ##X, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) > +#define ___COUNT_COMMAS(args...) COUNT_COMMAS(args) Oh! Oops, I missed that this _DOES_ already exist in Linux: cf14f27f82af ("macro: introduce COUNT_ARGS() macro") now in include/linux/args.h as COUNT_ARGS(): #define __COUNT_ARGS(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _n, X...) _n #define COUNT_ARGS(X...) __COUNT_ARGS(, ##X, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) I think this can be refactored to use that? -Kees -- Kees Cook