apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: apr_atomic_casptr macro (was Re: Showstopper ... was: Tagged the tree)
Date Fri, 10 Jan 2003 03:38:46 GMT
At 05:02 PM 1/9/2003, Brad Nicholes wrote:
>The original problem that caused us to have to type cast is the fact
>that our compiler complains about the type mismatch between void* and
>unsigned long.  How does this resolve that issue?  It still looks like I
>am going to get a type mismatch.

The code below shouldn't.

typedef void*(*apr_atomic_casptr_fn_t)(void** mem, const void *cmp, const void *with);
#define apr_atomic_casptr ((apr_atomic_casptr_fn_t)(atomic_cmpxchg))

IFF the stack setup for the atomic_cmpxchg fn and the 
apr_atomic_casptr_fn_t typedefs are the same, you are 
still using a cast, but applying it to the fn itself.  The args
are still evaluated, but in terms of apr_atomic_casptr_fn_t's
declaration ;-)

See how the optional functions behave to get a little bit more
clarity about how/why we've coded functions this way.


View raw message