Using gcc/tcc/clang's extensions to the C language (C11), is it possible to detect whether a macro argument has a pointer type?
Details: I'm using a macro that should take a singly-indirect pointer, but it's tempting to pass a pointer to that pointer because that's what the corresponsing "constructor" macro takes, but doing so would be an error, so I'm currently currently using something like:
#define ISPTR(X) (sizeof(X)==sizeof(void*)&&_Alignof(X)==_Alignof(void*)) /*inaccurate*/
#define TAKE_SINGLY_INDIRECT(P) do{ _Static_assert(!ISPTR(*(P)), "pass a singly indirect pointer"); /*...*/ }while(0)
to protect myself from myself. Is there a better way to implement ISPTR()
?