C11 _Generic usage
问题 I was trying to learn how to use the "new" C11 Generic expressions but I ran into a wall. Consider the following code: #include <stdlib.h> #include <stdio.h> #define test(X, Y, c) \ _Generic((X), \ double: _Generic((Y), \ double * : test_double, \ default: test_double \ ), \ int: _Generic((Y), \ int * : test_int, \ default: test_int \ ) \ ) (X, Y, c) int test_double(double a, double *b, int c); int test_int(int a, int *b, int c); int test_double(double a, double *b, int c) { return 1; } int