NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/48560: kevent.udata and void *

On Jan 29,  1:45pm, ( 
-- Subject: kern/48560: kevent.udata and void *

| For src/sys/sys/event.h
| I am told that kevent.udata should maybe be void * since C++ doesn't 
| allow the naive conversion from a pointer type to integer. Apparently 
| some other systems have that has void *
| error: invalid conversion from 'char*' to '__intptr_t'
| I am not sure what prompted the change.
| See
| for an example of __NetBSD__ workaround.

I believe this was done deliberately so that the "opaque user
identifier" was not just a pointer but an integer type (to indicate
that this does not necessary hold a pointer but it *can* hold one).
Nevertheless the reinterpret_cast<type *>(e->udata) takes care of
the issue. In C++ need a static_cast anyway since "void *" is not
fungible with other pointers (unless of course you are assigning to
"void *".


Home | Main Index | Thread Index | Old Index