Discussion:
sys/event.h's kevent.udata and c++
Jeremy C. Reed
2010-05-27 21:31:53 UTC
Permalink
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 *.

Before I change I get errors like:

../../../ext/asio/asio/detail/kqueue_reactor.hpp: In member function
'void asio::detail::kqueue_reactor::start_op(int,
asio::detail::socket_type,
asio::detail::kqueue_reactor::descriptor_state*&,
asio::detail::reactor_op*, bool)':
../../../ext/asio/asio/detail/kqueue_reactor.hpp:180: error: invalid
conversion from 'asio::detail::kqueue_reactor::descriptor_state*' to
'__intptr_t'

Okay to change that?
Jeremy C. Reed
2010-05-27 22:43:01 UTC
Permalink
Post by Jeremy C. Reed
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 *.
../../../ext/asio/asio/detail/kqueue_reactor.hpp: In member function
'void asio::detail::kqueue_reactor::start_op(int,
asio::detail::socket_type,
asio::detail::kqueue_reactor::descriptor_state*&,
../../../ext/asio/asio/detail/kqueue_reactor.hpp:180: error: invalid
conversion from 'asio::detail::kqueue_reactor::descriptor_state*' to
'__intptr_t'
Okay to change that?
http://svn.freebsd.org/viewvc/base/head/sys/sys/event.h?revision=201350&view=markup
?
Thanks for the FreeBSD example.

Okay for me to do the same in NetBSD?

:)
Alfred Perlstein
2010-05-27 22:50:37 UTC
Permalink
Post by Jeremy C. Reed
Post by Jeremy C. Reed
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 *.
../../../ext/asio/asio/detail/kqueue_reactor.hpp: In member function
'void asio::detail::kqueue_reactor::start_op(int,
asio::detail::socket_type,
asio::detail::kqueue_reactor::descriptor_state*&,
../../../ext/asio/asio/detail/kqueue_reactor.hpp:180: error: invalid
conversion from 'asio::detail::kqueue_reactor::descriptor_state*' to
'__intptr_t'
Okay to change that?
http://svn.freebsd.org/viewvc/base/head/sys/sys/event.h?revision=201350&view=markup
?
Thanks for the FreeBSD example.
Okay for me to do the same in NetBSD?
:)
Oops, I got my lists confused! :)

I'm not a NetBSD guru, so I'm not sure if that will be OK.

There's probably a cast you should be using. Using intptr_t
is probably superior to void*. I think this is just C++
being pedantic about casts.
--
- Alfred Perlstein
.- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
.- FreeBSD committer
Alfred Perlstein
2010-05-27 21:39:33 UTC
Permalink
Post by Jeremy C. Reed
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 *.
../../../ext/asio/asio/detail/kqueue_reactor.hpp: In member function
'void asio::detail::kqueue_reactor::start_op(int,
asio::detail::socket_type,
asio::detail::kqueue_reactor::descriptor_state*&,
../../../ext/asio/asio/detail/kqueue_reactor.hpp:180: error: invalid
conversion from 'asio::detail::kqueue_reactor::descriptor_state*' to
'__intptr_t'
Okay to change that?
It looks like udata is already void* in head:

http://svn.freebsd.org/viewvc/base/head/sys/sys/event.h?revision=201350&view=markup

?
--
- Alfred Perlstein
.- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10
.- FreeBSD committer
Loading...