Re: [PATCH] Fix git to be (more) ANSI C99 compliant.
Florian Forster <octo@verplant.org> wrote:
> GCC ignores the FAM in this case and allocates `sizeof (struct
> combine_diff_path)' bytes. However, this is not correct according to
> ANSI and prevents building using other compilers (e.g. Sun cc).
> To be honest, I don't get the point of FAMs anyways. Why don't we just
> use a pointer to `struct combine_diff_parent' there in the first place?
In general FAMs are used to replace two mallocs with one.
x = malloc(sizeof(struct foo) + 100)
instead of
x = malloc(sizeof(struct foo));
x->y = malloc(100);--
http://onion.dynserv.net/~timo/