消息“在GCC 4.4中传递具有灵活数组成员的结构的ABI”是否重要?

时间:2013-04-09 10:42:00

标签: c gcc compiler-construction

我想知道来自编译器的这条消息是否应该仔细考虑。

让我们看看以下代码:

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

我的问题是:在更大的项目中安全使用这种结构吗?这种结构可能带来哪些风险和影响(编译器消息除外)?

1 个答案:

答案 0 :(得分:-2)

  1. 关于内存,每次调用此函数时,都会创建结构变量以浪费内存。
  2. 确认你的项目中是否需要struct s c或struct s& c。