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, reed%reedmedia.net@localhost (reed%reedmedia.net@localhost) 
wrote:
-- 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.
| 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/sys/event.h.diff?r1=1.1.1.1.2.10&r2=1.1.1.1.2.11
| 
| See 
http://sourceforge.net/p/asio/git/ci/master/tree/asio/include/asio/detail/impl/kqueue_reactor.ipp
| 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 *".

christos


Home | Main Index | Thread Index | Old Index