xcode 成员引用基类型“int”不是结构或联合

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10336336/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 00:06:31  来源:igfitidea点击:

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

c++xcodeint

提问by Itzik984

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?

知道这个错误意味着什么吗?

采纳答案by Michael Burr

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 inthere, not a pointer to a struct.

a 的类型sigjmp_buf(它sigsetjmp()作为第一个参数)是不透明的——在这种情况下它不是你的代码所期望的。显然,int这里很简单,而不是指向结构的指针。

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).

如果您想处理 的内部结构,则sigjmp_buf需要研究它是如何在该特定平台上实现的(显然代码将不可移植)。