6 * array_size - routine for safely deriving the size of a visible array.
8 * This provides a simple ARRAY_SIZE() macro, which (given a good compiler)
9 * will also break compile if you try to use it on a pointer.
11 * This can ensure your code is robust to changes, without needing a gratuitous
15 * // Outputs "Initialized 32 values"
16 * #include <ccan/array_size/array_size.h>
20 * // We currently use 32 random values.
21 * static unsigned int vals[32];
26 * for (i = 0; i < ARRAY_SIZE(vals); i++)
28 * printf("Initialized %u values\n", i);
32 * License: Public domain
33 * Author: Rusty Russell <rusty@rustcorp.com.au>
35 int main(int argc, char *argv[])
40 if (strcmp(argv[1], "depends") == 0) {
41 printf("ccan/build_assert\n");