Guest User

Untitled

a guest
Dec 15th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #define COMPAT_P __builtin_types_compatible_p
  3. #define COMPAT_S(a,b) ((char*[]){"false","true"}[COMPAT_P(a,b)])
  4. #define COMPAT_PP(a,b) {printf("%s\n",COMPAT_S(a,b));}
  5.  
  6. int main(void)
  7. {
  8. typedef int a_t[3];
  9.  
  10. COMPAT_PP(a_t[4],int[4][3]);
  11. COMPAT_PP(a_t[4],int[3][4]);
  12.  
  13. return 0;
  14. }
  15.  
  16. #if 0
  17. [m@monire m]$ ./types_compat_p
  18. true
  19. false
  20. #endif
Add Comment
Please, Sign In to add comment