This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C ABI: struct/union inconsistency
- From: Richard Henderson <rth at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Fri, 27 Sep 2002 16:08:48 -0700
- Subject: Re: C ABI: struct/union inconsistency
- References: <20020927204348.GC19608@redhat.com> <95350000.1033160809@warlock.codesourcery.com>
On Fri, Sep 27, 2002 at 02:06:49PM -0700, Mark Mitchell wrote:
> Why not ask the kernel developers about something like:
>
> struct S __attribute__((possibly_empty)) {};
>
> ?
>
> The idea being that if S has no members, the size ends up zero.
As it happens, something like this was independently suggested
by Alan Cox, so it seems that this is a reasonable solution.
Also mentioned were arrays of such structures; to continue to
to allow arrays of one element, even if general arrays are not.
Also mentioned is
struct some_attribute S {
char degenerate[0];
};
which should continue to have size zero, even though it has
a named member.
r~