5 * minmax - typesafe minimum and maximum functions
7 * The classic implementation of minimum / maximum macros in C can be
8 * very dangerous. If the two arguments have different sizes, or
9 * different signedness, type promotion rules can lead to very
12 * This module implements typesafe versions, which will generate a
13 * compile time error, if the arguments have different types.
16 * #include <ccan/minmax/minmax.h>
19 * int main(int argc, char *argv[])
21 * printf("Signed max: %d\n", max(1, -1));
22 * printf("Unsigned max: %u\n", max(1U, -1U));
26 * Author: David Gibson <david@gibson.dropbear.id.au>
27 * License: CC0 (Public domain)
30 * // We need several gcc extensions
31 * tests_compile_without_features FAIL
33 int main(int argc, char *argv[])
35 /* Expect exactly one argument */
39 if (strcmp(argv[1], "depends") == 0) {
40 printf("ccan/build_assert\n");