错误:表达式必须是指向完整对象类型的指针(?)
这是我需要修改的C 函数。我试图将以前的 4 个字节的地址从“box”开始与 rt_tsk_self()
返回的 U32 值进行比较,但它只是给了我一个错误:“表达式必须是指向完整的对象类型”。
/*--------------------------- rt_free_box -----------------------------------*/
int rt_free_box (void *box_mem, void *box) {
/* Free a memory block, returns 0 if OK, 1 if box does not belong to box_mem */
if !(defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
int irq_dis;
endif
if (box < box_mem || box > ((P_BM) box_mem)->end) {
return (1);
}
//MODIFIED***********
if (*(box-4) != rt_tsk_self()) { //<--- error: #852: expression must be a pointer to a complete object type
return (1);
}
//***************
/*
other unrelated code
*/
return (0);
}
This is the function in C that I need to modify. I am trying to have PREVIOUS 4 bytes of address starting from "box" to compare with a returned U32 value from rt_tsk_self()
, but it just gives me the error that "expression must be a pointer to a complete object type".
/*--------------------------- rt_free_box -----------------------------------*/
int rt_free_box (void *box_mem, void *box) {
/* Free a memory block, returns 0 if OK, 1 if box does not belong to box_mem */
if !(defined(__TARGET_ARCH_7_M) || defined(__TARGET_ARCH_7E_M))
int irq_dis;
endif
if (box < box_mem || box > ((P_BM) box_mem)->end) {
return (1);
}
//MODIFIED***********
if (*(box-4) != rt_tsk_self()) { //<--- error: #852: expression must be a pointer to a complete object type
return (1);
}
//***************
/*
other unrelated code
*/
return (0);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在尝试取消引用
void *
。那是行不通的。试试这个:You're trying to dereference a
void *
. That won't work. Try this instead: