foreach: make test more accurate, fix for 64-bit gcc 4.4.3
[ccan] / ccan / foreach / test / compile_ok-const.c
1 #include <ccan/foreach/foreach.h>
2 #include <ccan/foreach/foreach.c>
3
4 /* Iterating over const pointers should work fine. */
5 int main(int argc, char *argv[])
6 {
7         const char *s1 = "hello", *s2 = "world", *p;
8         unsigned int i = 0;
9
10         foreach_ptr(p, s1, s2)
11                 i++;
12
13         return i == 2 ? 0 : 1;
14 }