NetBSD-Bugs archive

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

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



The following reply was made to PR kern/48560; it has been noted by GNATS.

From: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, kern-bug-people%netbsd.org@localhost, 
        gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/48560: kevent.udata and void *
Date: Wed, 29 Jan 2014 11:41:17 -0500

 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