[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Found a warning in libevent 2.0.21
On Tue, Sep 17, 2013 at 9:55 PM, Ralph Castain <rhc@xxxxxxxxxxxx> wrote:
> I found a really simple solution!
>
> #if defined(_EVENT_HAVE_ARC4RANDOM_BUF)
> /* OSX 10.7 introducd arc4random_buf, so if you build your program
> * there, you'll get surprised when older versions of OSX fail to run.
> * To solve this, we can check whether the function pointer is set,
> * and fall back otherwise. (OSX does this using some linker
> * trickery.)
> */
> {
> void* tptr = (void*)arc4random_buf;
> if (tptr != NULL) {
> return arc4random_buf(buf, n);
> }
> }
> #endif
>
> Silences the warning just fine.
Does it still work if you cast it to void (*tptr)() ? ISTR that
according to the C standard, function pointers can be cast to that,
but not to void*. (Not that that stops anybody, but it's nice to be
pedantic when we can.)
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users in the body.