This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: C ABI: struct/union inconsistency
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Fri, 27 Sep 2002 17:21:21 +0100 (BST)
- Subject: Re: C ABI: struct/union inconsistency
On Wed, 25 Sep 2002, Mark Mitchell wrote:
> Accepting empty structures in C is an extension, but structures like S
> (i.e., with a single zero-width bitfield) are part of the language.
They are not; a structure with no named members is undefined behavior
(6.7.2.1#7), and a zero-width bit-field may not be named (6.7.2.1#3).
> might be. I also do not know if some piece of code in the Linux
> kernel is going to depend on the current behavior; we might want to
> have a switch for the old behavior.
Linux uses size 0 empty structures for efficiency (types that only need be
nonempty in SMP kernels), but only with sufficiently recent GCC; with
older GCC nonempty dummy structures are used because of compiler bugs.
--
Joseph S. Myers
jsm28@cam.ac.uk