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] | |
aliasing when GCC (I think) incorrectly treats types different, but they're the same. For example, I have:I also think this case should not be flagged. I have seen similar usage in network programming. Did it actually result in bad code or was it just the warning that bothered you?
struct Point { float x, y, z; };
struct Vector { float x, y, z;
Point &asPoint() { return reinterpret_cast<Point&>(*this); } };
Point and Vector have the same layout, but GCC treats them different when it does aliasing analysis. I have problems when I use Vector::asPoint.
:) Thanks for your responses.
You're welcome. Silvius
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |