我有一个struct
包含两个整数。
struct ref{
int next;
int marked;
}
我需要使用 CAS 原子地比较其中两个结构。
__sync_bool_compare_and_swap(&(ref1),old,new);
我如何才能struct
将其转换为long long
c 中的 a 引用?
我试过这个:
__sync_bool_compare_and_swap(&((long long)(ref1)),(long long)(old),(long long)(new));
但它给了我这个错误:
aggregate value used where an integer was expected