On 11.08.2019 02:56, Valery Ushakov wrote: > Kamil Rytarowski <[email protected]> wrote: > >> Cast of udata from void* to intptr_t shall be done with >> reinterpret_cast<> otherwise a C++ compiler errors. >> >> Defining __REINTERPRET_CAST [1] and using it, did not work as a compiler >> protested for NULL argument "warning: passing NULL to non-pointer argument". >> >> Using double cast __REINTERPRET_CAST(intptr_t, __CAST(void *, (udata))) >> pacified the warning/error about passing NULL in C++, but it created the >> problem of calling EV_SET using the native argument type intptr_t. > > You are reporting quite an abstract summary that is not so easy to > follow for someone who hasn't done all the same experiments that you > already have done.
$ cat /tmp/test.cpp
#include <sys/types.h>
#include <sys/event.h>
int
main(int argc, char **argv)
{
struct kevent kv;
EV_SET(&kv, 0, 0, 0, 0, 0, 0);
EV_SET(&kv, 0, 0, 0, 0, 0, NULL);
EV_SET(&kv, 0, 0, 0, 0, 0, nullptr);
EV_SET(&kv, 0, 0, 0, 0, 0, 0L);
EV_SET(&kv, 0, 0, 0, 0, 0, 0LL);
EV_SET(&kv, 0, 0, 0, 0, 0, 0U);
EV_SET(&kv, 0, 0, 0, 0, 0, 0UL);
EV_SET(&kv, 0, 0, 0, 0, 0, 0ULL);
EV_SET(&kv, 0, 0, 0, 0, 0, (intptr_t)0);
EV_SET(&kv, 0, 0, 0, 0, 0, (uintptr_t)0);
return 0;
}
signature.asc
Description: OpenPGP digital signature
