compile_fail-function-param.c 374 B

123456789101112131415161718192021
  1. #include <ccan/array_size/array_size.h>
  2. #include <stdlib.h>
  3. struct foo {
  4. unsigned int a, b;
  5. };
  6. int check_parameter(const struct foo array[4]);
  7. int check_parameter(const struct foo array[4])
  8. {
  9. #ifdef FAIL
  10. return (ARRAY_SIZE(array) == 4);
  11. #else
  12. return sizeof(array) == 4 * sizeof(struct foo);
  13. #endif
  14. }
  15. int main(int argc, char *argv[])
  16. {
  17. return check_parameter(NULL);
  18. }