[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15825: unidata-gen seems messed up somehow

From: Paul Eggert
Subject: bug#15825: unidata-gen seems messed up somehow
Date: Fri, 08 Nov 2013 00:07:43 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0

Eli Zaretskii wrote:
> What does 'sizeof' return for a struct that has array[0] at the end?

For something like this:

   struct s { ...; int data[]; };

C99 says sizeof (struct s) == offsetof (struct s, data).
C89 doesn't have this concept, so for portability
we do this in C89:

   struct s { ...; int data[1]; };

and use offsetof (struct s, data) instead of
sizeof (struct s), as the latter's wrong for C89.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]