title: Declaration of Volatile Pointer Array in C++
body: <p>I have  a struct called Ambigous, and inside the struct I have an array of pointers to other Ambigous.</p>
  
  <p>I want to use OSAtomic.h library, to do CompareandSwaps.</p>
  
  <p>However I am having trouble getting the array to play nice.</p>
  
  <pre><code> OSAtomicCompareAndSwapPtrBarrier(void *__oldValue, void *__newValue, 
  void *volatile *__theValue)
  </code></pre>
  
  <p>is the compare and swap function.</p>
  
  <p>and inside my struct I have</p>
  
  <pre><code> Ambigous * volatile* list;
  </code></pre>
  
  <p>and the call is</p>
  
  <pre><code>bool res=OSAtomicCompareAndSwapPtrBarrier(current_node, new_node, local-&gt;list[pos]);
  </code></pre>
  
  <p>When I try to cas by</p>
  
  <pre><code>bool res=OSAtomicCompareAndSwapPtrBarrier(current_node, new_node, (void * volatile *)local-&gt;list[pos]);
  </code></pre>
  
  <p>I get a bad EXE_BAD_ACCESS</p>
  
  <p>So i guess what i am answering is how should i declare the array of volatile pointers?</p>