Re: EV_SET() better C++ compat with alternative implementations

2019-08-13 Thread Valery Ushakov
On Wed, Aug 14, 2019 at 06:06:18 +0300, Valery Ushakov wrote: > static inline void > EV_SET_(struct kevent *_kevp, uintptr_t _ident, uint32_t _filter, > uint32_t _flags, uint32_t _fflags, int64_t _data, > uintptr_t _udata) > { > _kevp->ident = _ident; > _kevp->filter = _f

Re: EV_SET() better C++ compat with alternative implementations

2019-08-13 Thread Valery Ushakov
On Sun, Aug 11, 2019 at 03:57:50 +0200, Kamil Rytarowski wrote: > On 11.08.2019 02:56, Valery Ushakov wrote: > > Kamil Rytarowski wrote: > > > >> Cast of udata from void* to intptr_t shall be done with > >> reinterpret_cast<> otherwise a C++ compiler errors. > >> > >> Defining __REINTERPRET_CAST

Re: EV_SET() better C++ compat with alternative implementations

2019-08-13 Thread Kamil Rytarowski
On 13.08.2019 21:21, Joerg Sonnenberger wrote: > On Tue, Aug 13, 2019 at 08:44:04PM +0200, Kamil Rytarowski wrote: >> void* does not prevent storing inside it numbers. > > While not necessarily relevant in the NetBSD context, this is generally > false. Casting random values to a pointer is UB. >

Re: EV_SET() better C++ compat with alternative implementations

2019-08-13 Thread Joerg Sonnenberger
On Tue, Aug 13, 2019 at 08:44:04PM +0200, Kamil Rytarowski wrote: > void* does not prevent storing inside it numbers. While not necessarily relevant in the NetBSD context, this is generally false. Casting random values to a pointer is UB. Joerg

Re: EV_SET() better C++ compat with alternative implementations

2019-08-13 Thread Kamil Rytarowski
On 13.08.2019 20:22, Jaromir Dolecek wrote: > I think the rationale was to make it possible to use for integer values and > operations without cast. And make it clear it can hold arbitrary value, not > necessarily pointer. Unfortunately intptr_t has different size in 32 vs 64 > bit same as void

Re: EV_SET() better C++ compat with alternative implementations

2019-08-13 Thread Jaromir Dolecek
I think the rationale was to make it possible to use for integer values and operations without cast. And make it clear it can hold arbitrary value, not necessarily pointer. Unfortunately intptr_t has different size in 32 vs 64 bit same as void *, which I didnt consider. Using (void *) would be