Fre*_*Foo 10
如果你的意思是GCC源代码中提到的尾随数组习惯用法(你的引用来自哪里),它似乎引用旧的C技巧来实现动态数组:
typedef struct {
/* header */
size_t nelems;
/* actual array */
int a[1];
} IntVector;
Run Code Online (Sandbox Code Playgroud)
用数据创建数组的位置
IntVector *make_intvector(size_t n)
{
IntVector *v = malloc(sizeof(IntVector) + sizeof(int) * (n-1));
if (v != NULL)
v->nelems = n;
return v;
}
Run Code Online (Sandbox Code Playgroud)