我想知道编译器发出的这条消息是否值得我们仔细考虑。
让我们看下面的代码:
struct s
{
int a;
int b[];
};
void fun(struct s c)
{
}
int main()
{
return 0;
}
出现以下错误:
main.c:7:6: note: the ABI of passing struct with a flexible array member has changed in GCC 4.4
我的问题是:在更大的项目中使用这样的结构安全吗?这种结构的可能风险和影响是什么(除编译器消息外)?
最佳答案
- 关于内存,每次我们调用此函数时都会创建结构变量,因此会浪费内存。
- 确认您的项目中是否需要 struct s c 或 struct s &c。
关于c - 消息 "the ABI of passing struct with a flexible array member has changed in GCC 4.4"重要吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15899774/