Compile time check against multiple types in C?
Currently I have a macro to check a value is a type. #define CHECK_TYPE_INLINE(val, type) \ ((void)(((type)0) != (0 ? (val) : ((type)0)))) This is useful to be able to type-check macro args in some cases. But what if I were to check against multiple types? for example, to check if it's a struct Foo * or struct Bar * . Example, static inline _insert_item(struct List *ls, void *item) { /* function body*/ } /* type-checked wrapper */ #define insert_item(ls, item) \ (CHECK_TYPE_ANY(item, struct Foo *, struct Bar *), \ _insert_item(ls, item)) Is there some good way to do this? Since this is tagged