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] | |
Mark Mitchell wrote:
Will the UK committee open a DR for this? Or, would you care to send mail to Steve Adamczyk about it?
this can be done. I shall wait until the minutes have been written up.
The observation was made that if A is non-POD, one cannot play offsetof tricks to get from A::a to A::b, so the optimization is safe on non-PODs. (Of course one would have to prove the address of 'v' did not escape, so I guess the ctor and dtor would need to be trivial or visible.)
I argued last week that this was not in fact true, in that you can do:
ptrdiff_t x = &v.b - &v.a;
and then use that instead of "offsetof (Foo, b) - offsetof (Foo, a)".
Does not '&v.b - &v.a' cause the address to 'escape', and therefore lock down the structure? If it doesn't, how hard would it be to make that DTRT?
-- Mark Mitchell CodeSourcery, LLC mark@codesourcery.com (916) 791-8304
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |