]> git.ozlabs.org Git - ccan/blob - ccan/minmax/_info
memmem, bytestring: Fix includes in _info
[ccan] / ccan / minmax / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 /**
6  * minmax - typesafe minimum and maximum functions
7  *
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
11  * surprising results.
12  *
13  * This module implements typesafe versions, which will generate a
14  * compile time error, if the arguments have different types.
15  *
16  * Example:
17  *      #include <ccan/minmax/minmax.h>
18  *      #include <stdio.h>
19  *
20  *      int main(int argc, char *argv[])
21  *      {
22  *              printf("Signed max: %d\n", max(1, -1));
23  *              printf("Unsigned max: %u\n", max(1U, -1U));
24  *              return 0;
25  *      }
26  *
27  * Author: David Gibson <david@gibson.dropbear.id.au>
28  * License:  CC0 (Public domain)
29  *
30  * Ccanlint:
31  *      // We need several gcc extensions
32  *      tests_compile_without_features FAIL
33  */
34 int main(int argc, char *argv[])
35 {
36         /* Expect exactly one argument */
37         if (argc != 2)
38                 return 1;
39
40         if (strcmp(argv[1], "depends") == 0) {
41                 printf("ccan/build_assert\n");
42                 return 0;
43         }
44
45         return 1;
46 }