[MPlayer-dev-eng] [PATCH] Drop support for gcc-2.95
Rich Felker
dalias at aerifal.cx
Thu Jul 13 01:40:21 CEST 2006
On Wed, Jul 12, 2006 at 11:59:53PM +0200, Joerg Sonnenberger wrote:
> On Tue, Jul 11, 2006 at 05:27:47PM -0400, Rich Felker wrote:
> > > and flexible array members. They're usually not
> > > hard to work around using C89 syntax but still allow for nicer code.
> >
> > Flexible array members are in no way better than just including a
> > one-element array at the end of the structure, which is guaranteed to
> > work as a consequence of other requirements in the C standard.
>
> They are. Try the attached program on any normal architecture.
>
> Joerg
> struct {
> long double foo;
> char bar[1];
> } test1;
>
> struct {
> long double foo;
> char bar[];
> } test2;
>
> #include <stdio.h>
>
> int main(void)
> {
> printf("%zd %zd\n", sizeof(test1), sizeof(test2) + sizeof(char));
> return 0;
> }
I'm aware of this difference, but it's a small issue to deal with when
calling malloc if you _really_ want to save the few bytes...
malloc(offsetof(struct test1, bar) + chars_needed)
Rich
More information about the MPlayer-dev-eng
mailing list