This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: g++-4.0.3: program output is different when compiled with -O3 (did not happen with gcc-3.4.5)
- From: John Love-Jensen <eljay at adobe dot com>
- To: Erik <sigra at home dot se>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Mon, 15 May 2006 06:20:57 -0500
- Subject: Re: g++-4.0.3: program output is different when compiled with -O3 (did not happen with gcc-3.4.5)
Hi Erik,
I think you just need to rework your operator< a little bit, and you'll be
fine.
struct Coords {
bool operator<(const Coords other) const {
Uint32 lhs = (Uint32(x) << 16) | Uint32(y);
Uint32 rhs = (Uint32(other.x) << 16) | Uint32(other.y);
return lhs < rhs;
}
int x : 16, y : 16;
};
HTH.
--Eljay