This is the mail archive of the gcc-bugs@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]

Re: weird code generation differences without optimization [was Re: purify 4.1 and egcs still appear to be incompatible.]


Paul Koning wrote:
> 
>  Ian> The reason for the "unnecessary" copy is that the default copy
>  Ian> ctor/assignment op are defined simply to do bitwise copy.  And
>  Ian> the standard, unfortunately, also requires that even "empty"
>  Ian> structs take up space.
> 
> ???  I thought the rule for default copy is to do memberwise copy, and
> explicitly NOT bitwise copy.
> 
>         paul
I'm sorry.  I misspoke there.  You're right that memberwise copy is required,
not bitwise copy.  And it also appears that the unused byte is not considered a
member.
So I was wrong in saying that the single byte taken up by an empty class should
be (or is even allowed to be) copied by a conforming C++ implementation.
-- 
Ian Haggard  ||  ian@shellus.com (work)  ||  IanHaggard@juno.com (home)
GNU/Linux -- "Oh, no, Mr Bill!" || #define employer_opinion !my_opinion


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