Compile-time assertion to determine if pointer is an array
问题 Currently, I have the following block of code to make safe string copying (it works): #define STRCPY(dst, src) do { assert(((void*)(dst)) == ((void*) & (dst))); \ strlcpy(dst, src, sizeof(dst)); } while (0) So it accepts the construction like: const char *src = "hello"; char dest[5]; STRCPY(dest, src); //hell And denies the following: void (char *dst) { STRCPY(dst, "heaven"); //unknown size of dst } The problem is that the block of code creates an assertion. Is there a way to perform this