【发布时间】:2011-04-06 01:22:47
【问题描述】:
在这个程序中:
int x, y;
int *old = &x;
int *new = &y;
int * volatile cur = &x;
OSAtomicCompareAndSwapPtrBarrier(old, new, &cur);
我收到此警告:
不兼容的指针将'int *volatile *'传递给'void *volatile *'类型的参数
关于 XCode 4.0.1 的默认编译器。 (实际上是实时问题。)
现在,我知道通常我不能将 int** 转换为 void** 。但如果我不这样做,我看不到任何方法来比较和交换和 int* 而不会收到上述警告。我应该忽略警告,假设它是指针大小不统一时期的遗物,还是我误解了什么?
【问题讨论】:
标签: c macos casting atomic void