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 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


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