Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4083172
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:16:46+00:00 2026-05-20T18:16:46+00:00

I have a struct called Ambigous, and inside the struct I have an array

  • 0

I have a struct called Ambigous, and inside the struct I have an array of pointers to other Ambigous.

I want to use OSAtomic.h library, to do CompareandSwaps.

However I am having trouble getting the array to play nice.

 OSAtomicCompareAndSwapPtrBarrier(void *__oldValue, void *__newValue, 
void *volatile *__theValue)

is the compare and swap function.

and inside my struct I have

 Ambigous * volatile* list;

and the call is

bool res=OSAtomicCompareAndSwapPtrBarrier(current_node, new_node, local->list[pos]);

When I try to cas by

bool res=OSAtomicCompareAndSwapPtrBarrier(current_node, new_node, (void * volatile *)local->list[pos]);

I get a bad EXE_BAD_ACCESS

So i guess what i am answering is how should i declare the array of volatile pointers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:16:47+00:00Added an answer on May 20, 2026 at 6:16 pm

    Perhaps you want

    bool res = OSAtomicCompareAndSwapPtrBarrier(
                  current_node, new_node, local->list + pos);
    

    Note that the CAS operation is basically

    bool CAS(void* old, void* new_, void* volatile* val) {
       /*atomic*/ {
         if (old == *val) {
             *val = new_;
             return true;
         } else
             return false;
       }
    }
    

    If you pass a list[pos], the 3rd argument will be of type Ambigous*, and *val will be of type struct Ambigous which cannot be compared to a pointer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Array of MKAnnotation objects called arrAnnotations . I want to pick
I have a struct called Point. Point is pretty simple: struct Point { Row
I have a struct called coordinate which is contained in a list in another
I have a struct called Point (which happens to be a Python Extension) that
This is really a noob quick question. Imagine you have a struct called No
I am trying to model a network using C++. I have a struct called
Suppose I have a struct called foo_boolean that contains some boolean values: struct foo_boolean
I have build a Ruby extension in Objective-C. Now I want to use @throw/@catch
I have a struct called CoolStruct: struct CoolStruct { int id; uint32 type; uint32
I have a class called CoolMenuItems class CoolMenuItems { public: CoolMenuItems(); ~CoolMenuItems(); struct MenuItemOne

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.