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)
30 int main(int argc, char *argv[])
32 /* Expect exactly one argument */
36 if (strcmp(argv[1], "depends") == 0) {
37 printf("ccan/build_assert\n");
41 if (strcmp(argv[1], "ccanlint") == 0) {
42 /* We need several gcc extensions */
43 printf("tests_compile_without_features FAIL\n");