Re: Glib Atomic Operations



On Fri, 2011-10-07 at 09:24 -0400, Morten Welinder wrote:
> > what is the purpose of  '(void) (0 ? *(atomic) ^ *(atomic) : 0)'?
> 
> Poor man's type check.  That expression isn't valid for every
> possible "atomic".

Specifically, it ensures that the destination of the pointer is an
integral type.  You can't perform ^ (xor) on a pointer, struct, double,
etc.

Notice that this check is omitted for the _pointer_ variant -- which is
(of course) expected to work on pointers.

Cheers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]