@Lundin shows how to check if a passed expression is an array at compile-time here: Lvalue conversion of _Generic controlling expression involving array clang warning wrong?:
#define IS_ARRAY(T)
_Generic( &(T),
typeof(*T) (*)[] : true,
default : false
)
Can we further differentiate between an array which has variable length array type and one which does not?
Why do I need this? I have a generic SWAP()
that does not work for VLAs. I would like to check at compile-time (static_assert
) whether a VLA was passed to SWAP()
and guide the user to use another variant of SWAP()
that work for VLAs.