This is the mail archive of the 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: structure members of packed structures

On Tue, 2003-07-15 at 09:51, Alexandre Oliva wrote:
> On Jul 15, 2003, Mark Mitchell <> wrote:
> >> Another question. What about
> >> struct __attribute__((packed)) Foo
> >> {
> >> T m;
> >> };
> >> 
> >> here m happens to fall at an aligned address, and the size of Foo happens
> >> to be a multiple of that alignment. Should m be DECL_PACKED or not?
> > I say yes.
> Does this mean T needs packed ctors, dtor and member functions? 


>  Are
> they implicitly generated from the non-packed ones, or must the user
> define them explicitly?

T should be declared packed itself.  It does not make sense to have
sometimes-packed non-PODs.  You would -- at the very least -- have to
make modifications to all the overloading rules.

All this is academic because we're not going to impelement it right now;
Nathan is going to do a minimal fix for a customer and move on.  But we
were trying to figure out what the right answer *would* be so that we
can implement it "some day".

Mark Mitchell <>
CodeSourcery, LLC

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