6 * structeq - bitwise comparison of structs.
8 * This is a replacement for memcmp, which checks the argument types are the
9 * same, and takes into account padding in the structure. When there is no
10 * padding, it becomes a memcmp at compile time (assuming a
11 * constant-optimizing compiler).
14 * Author: Rusty Russell <rusty@rustcorp.com.au>
17 * #include <ccan/structeq/structeq.h>
18 * #include <ccan/build_assert/build_assert.h>
24 * // Defines mydata_eq(a, b)
25 * STRUCTEQ_DEF(mydata, 0, start, end);
35 * assert(mydata_eq(&a, &b));
38 * // Now they are not.
39 * assert(!mydata_eq(&a, &b));
44 int main(int argc, char *argv[])
46 /* Expect exactly one argument */
50 if (strcmp(argv[1], "depends") == 0) {
51 printf("ccan/build_assert\n");
52 printf("ccan/cppmagic\n");