_info 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "config.h"
  2. #include <stdio.h>
  3. #include <string.h>
  4. /**
  5. * array_size - routine for safely deriving the size of a visible array.
  6. *
  7. * This provides a simple ARRAY_SIZE() macro, which (given a good compiler)
  8. * will also break compile if you try to use it on a pointer.
  9. *
  10. * This can ensure your code is robust to changes, without needing a gratuitous
  11. * macro or constant.
  12. *
  13. * Example:
  14. * // Outputs "Initialized 32 values\n"
  15. * #include <ccan/array_size/array_size.h>
  16. * #include <stdlib.h>
  17. * #include <stdio.h>
  18. *
  19. * // We currently use 32 random values.
  20. * static unsigned int vals[32];
  21. *
  22. * int main(void)
  23. * {
  24. * unsigned int i;
  25. * for (i = 0; i < ARRAY_SIZE(vals); i++)
  26. * vals[i] = random();
  27. * printf("Initialized %u values\n", i);
  28. * return 0;
  29. * }
  30. *
  31. * License: CC0 (Public domain)
  32. * Author: Rusty Russell <rusty@rustcorp.com.au>
  33. */
  34. int main(int argc, char *argv[])
  35. {
  36. if (argc != 2)
  37. return 1;
  38. if (strcmp(argv[1], "depends") == 0) {
  39. printf("ccan/build_assert\n");
  40. return 0;
  41. }
  42. return 1;
  43. }