c - 消息 "the ABI of passing struct with a flexible array member has changed in GCC 4.4"重要吗?

标签 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. 关于内存,每次我们调用此函数时都会创建结构变量,因此会浪费内存。
  2. 确认您的项目中是否需要 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/

相关文章:

java - 编译 JNI 的问题

c# - 当两个重载具有相同的签名时调用构造函数重载

javascript - 将另一种语言编译为 Javascript 的实用性?

c - 给定函数标识符,是否有命令行程序或库函数提供存储在 elf 文件中的地址

交叉编译Linux wifi驱动

windows - 适用于 Windows 的 gcc 4.7 二进制文件

c++ - GCC 函数的 Visual C++ 版本

c - 编程 C : default arguments in a macro?

无法从 'double' 转换为 'double (*)'

C++ 为模板类/结构设置自己的转换规则