apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brad Nicholes" <BNICHO...@novell.com>
Subject apr_atomic_casptr macro (was Re: Showstopper ... was: Tagged the tree)
Date Thu, 09 Jan 2003 23:02:15 GMT
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.

Brad Nicholes
Senior Software Engineer
Novell, Inc., the leading provider of Net business solutions
http://www.novell.com 

>>> Brian Pane <brian.pane@cnet.com> Thursday, January 09, 2003
10:44:42 AM >>>
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



Mime
View raw message