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