Herman Geza wrote:
aliasing when GCC (I think) incorrectly treats types different, but they're the same. For example, I have:

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.
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?

:)  Thanks for your responses.
You're welcome.
Silvius

Reply via email to