#include #define TEST(a,b) printf("%s, %s => %s\n", #a, #b, __builtin_choose_expr(__builtin_types_compatible_p(a,b),"true","false")) int main() { TEST(char*, char*); TEST(char*, const char*); TEST(const char*, char*); TEST(char[], char*); TEST(char*, char[]); TEST(char[], const char[]); TEST(typeof("hello"), char*); TEST(typeof("hello"), char[]); TEST(typeof("hello"), const char*); TEST(typeof("hello"), const char[]); TEST(typeof(&(*"hello")), char*); TEST(typeof(&(*"hello")), char[]); TEST(typeof(&(*"hello")), const char*); TEST(typeof(&(*"hello")), const char[]); TEST(typeof(*(&"hello")), char*); TEST(typeof(*(&"hello")), char[]); TEST(typeof(*(&"hello")), const char*); TEST(typeof(*(&"hello")), const char[]); TEST(typeof(&(("hello")[0])), char*); TEST(typeof(&(("hello")[0])), char[]); TEST(typeof(&(("hello")[0])), const char*); TEST(typeof(&(("hello")[0])), const char[]); char *char_ptr; const char *const_char_ptr; char char_arr[1]; const char const_char_arr[1]; TEST(typeof(&((char_ptr)[0])), char*); TEST(typeof(&((char_ptr)[0])), const char*); TEST(typeof(&((const_char_ptr)[0])), char*); TEST(typeof(&((const_char_ptr)[0])), const char*); TEST(typeof(&((char_arr)[0])), char*); TEST(typeof(&((char_arr)[0])), const char*); TEST(typeof(&((const_char_arr)[0])), char*); TEST(typeof(&((const_char_arr)[0])), const char*); return 0; }