i have a simple question: why does gcc say that i have a mismatch at the two lines?
WARNING: pointer/integer type mismatch in conditional expression
#define TEST(v) _Generic((v),
_Bool: (v) ? "true" : "false", \
char*: (v) ? (v) : "null", /* <- WARNING */ \
const char*: (v) ? (v) : "null", /* <- WARNING */ \
default: (v))
_Bool s = FALSE;
printf(TEST(s));
printf("\n");
char *c = "string";
printf(TEST(c));
printf("\n");
char *x = NULL;
printf(TEST(x));
printf("\n");
EDIT:
float f = 5;
printf(TEST(f));
printf("\n");
this example will cause an
ERROR: type mismatch in conditional expressionwhy is float or double so different at this point?