Yubin Ruan <ablacktsh...@gmail.com> writes:
> Hi,
>
> typesaft_cb_cast() is defined in typesaft_cb.h as:
>
>     #define typesafe_cb_cast(desttype, oktype, expr)                  \
>       __builtin_choose_expr(                                        \
>               __builtin_types_compatible_p(__typeof__(0?(expr):(expr)), \
>                                            oktype),                           
>       \
>               (desttype)(expr), (expr))
>
> what is the point of that "0?(expr):(expr)" ?

Hi Yubin!

        I had to search through git history to find it!  It serves to
decay a function type to a function pointer, otherwise
__builtin_types_compatible_p(func, functype) returns false because
func isn't a pointer to a function, it's a function.

Cheers,
Rusty.
_______________________________________________
ccan mailing list
ccan@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/ccan

Reply via email to