1 #include <ccan/typesafe_cb/typesafe_cb.h>
4 static void _register_callback(void (*cb)(void *arg), void *arg)
8 #define register_callback(cb, arg) \
9 _register_callback(typesafe_cb(void, void *, (cb), (arg)), (arg))
11 static void my_callback(char *p)
17 char str[] = "hello world";
20 #if !HAVE_TYPEOF||!HAVE_BUILTIN_CHOOSE_EXPR||!HAVE_BUILTIN_TYPES_COMPATIBLE_P
21 #error "Unfortunately we don't fail if typesafe_cb_cast is a noop."
28 /* This should work always. */
29 register_callback(my_callback, str);
31 /* This will fail with FAIL defined */
32 register_callback(my_callback, p);