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