[Gc] Re: [libatomic_ops] cas ptr (#5)

Ivan Maidanski ivmai at mail.ru
Sat Sep 8 12:26:42 PDT 2012

Hi Matthew,

Sat, 8 Sep 2012 11:37:14 -0700 Matthew Wilson <notifications at github.com>:
> The header says "All operations operate on unsigned AO_t, which is the natural word size, and usually unsigned long". 

This should be refined, I think. AO_t is typically size_t which should be (normally) the same size of pointer.

Also, there could be atomic operations defined for other types (like char, short, int) on some platforms.

> Does this mean it can't CAS a pointer, or that it can?  The APR has apratomic_casptr (see https://apr.apache.org/docs/apr/trunk/group__apr__atomic.html), which works for me on 64-bit. But I'm looking at using this library instead for the atomic operations because of the memory barrier precision.  So I'm just wondering whether this library will let me CAS pointers on 64-bit.

Yes, cast between a pointer type and AO_t is valid both on 32- and 64-bit targets.

> Thanks again!
>> Reply to this email directly or view it on GitHub.


More information about the Gc mailing list