Search code examples
c++xcodeint

Member reference base type 'int' is not a structure or union


I have the following code:

void setup()
{
address_t sp, pc;

sp = (address_t)stack1 + STACK_SIZE - sizeof(address_t);
pc = (address_t)f;


sigsetjmp(jbuf[0],1);
(jbuf[0]->__jmpbuf)[JB_SP] = translate_address(sp);<----ERROR
(jbuf[0]->__jmpbuf)[JB_PC] = translate_address(pc);<----ERROR
sigemptyset(&jbuf[0]->__saved_mask);<----ERROR     


sp = (address_t)stack2 + STACK_SIZE - sizeof(address_t);
pc = (address_t)g;

sigsetjmp(jbuf[1],1);
(jbuf[1]->__jmpbuf)[JB_SP] = translate_address(sp);<----ERROR
(jbuf[1]->__jmpbuf)[JB_PC] = translate_address(pc);<----ERROR
sigemptyset(&jbuf[1]->__saved_mask);<----ERROR

}

Any idea of what this error means?


Solution

  • The type of a sigjmp_buf (which is what sigsetjmp() takes as a first parameter) is opaque — it's not what your code is expecting it to be in this case. Apparently, it's a simple int here, not a pointer to a struct.

    If you want to muck around with the internals of the sigjmp_buf, you'll need to look into how it's implemented on that particular platform (and obviously the code will not be portable).