weird code generation differences without optimization [was Re: purify 4.1 and egcs still appear to be incompatible.]
Ian Haggard
ian@shellus.com
Tue Feb 17 16:04:00 GMT 1998
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
More information about the Gcc-bugs
mailing list