This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C ABI: struct/union inconsistency


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]