The two things have two totally different semantics:
- array[0] is a zero-sized array, and is a long-time gcc extension that
has nothing to do with the modern "flexible array". The kernel uses
zero-sized arrays, because flexible arrays simply aren't historically
supported by gcc at all.
- array[] is the standard "flexible array" thing, and has different rules
than array[0]. For example, sizeof() is undefined on flexible arrays,
but is well-defined on zero-sized ones (at zero). Also, the alignment
constraints are potentially quite different.
The gcc people want to make the two behave fairly similarly to ease
implementation issues, but they are definitely not the same.
> My mistake. The old code is Ok for C99, but broken for ANSI-C.
The old code is ugly and arguably always broken, I agree 100% with making
the usage code use "pp->entries". Whether the allocators use "sizeof" or
"offsetof" is secondary, at worst it ends up being conservative.
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/