tech-userlevel archive

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

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



Kamil Rytarowski <n54%gmx.com@localhost> wrote:

> Cast of udata from void* to intptr_t shall be done with
> reinterpret_cast<> otherwise a C++ compiler errors.
> 
> Defining __REINTERPRET_CAST [1] and using it, did not work as a compiler
> protested for NULL argument "warning: passing NULL to non-pointer argument".
> 
> Using double cast __REINTERPRET_CAST(intptr_t, __CAST(void *, (udata)))
> pacified the warning/error about passing NULL in C++, but it created the
> problem of calling EV_SET using the native argument type intptr_t.

You are reporting quite an abstract summary that is not so easy to
follow for someone who hasn't done all the same experiments that you
already have done.  That's not a very efficient way to ask for review
b/c every single reader that would like to actually review you change
have to redo your work more or less from first principles.

Please, can you provide specific examples?  Including examples for the
two failed experiments you mention.

What has been committed (which is not what has been proposed) looks
quite baroque and lacks any comments in the code as to why the code is
done that way.

From a quick glance all the overloads you define promptly cast away
the type of the argument they are overloaded on, which kinda hints
that the chosen approach might not be the best.

-uwe



Home | Main Index | Thread Index | Old Index