William A. Rowe, Jr. wrote:

In that case... what about a trick (I believe) Ben Laurie taught us?
Using a typedef for clarity:

typedef void*(*apr_atomic_casptr_fn_t)(unsigned long* mem, unsigned long cmp, 
unsigned long with);

#define apr_atomic_casptr ((apr_atomic_casptr_fn_t)(atomic_cmpxchg))

In this way, the arguments to apr_atomic_casptr will be evaluated in terms
of the apr_atomic_casptr_fn_t declaration.

This presumes the arguments exactly match the atomic_cmpxchg function, with the exception of twos-compliment signedness.

Make sense?


I like the typedef approach, but shouldn't it be

typedef void*(*apr_atomic_casptr_fn_t)(void** mem, const void *cmp, const void 
*with);

since casptr operates on pointers rather than ints?

Brian




Reply via email to