On Tue, Oct 28, 2008 at 11:38:25PM +0000, corvid wrote:
Thomas wrote:
Then at last, there's an unresolved warning:
dillo2-cvs/dw$ LANG=C make textblock.o g++ -DHAVE_CONFIG_H -I. -I.. -I/usr/local/include -march=pentium-m -O3 -Wall -W -Wno-unused-parameter -MT textblock.o -MD -MP -MF .deps/textblock.Tpo -c -o textblock.o textblock.cc ../lout/misc.hh: In member function 'void dw::Textblock::addLine(int, bool)': ../lout/misc.hh:161: warning: assuming signed overflow does not occur when assuming that (X - c) > X is always false mv -f .deps/textblock.Tpo .deps/textblock.Po
It's about this assert:
inline T* getRef (int i) { if (BOUND_CHECKING) assert (i >= 0 && i < this->num); return array + i; }
Ideas to please gcc with this assert? I am not sure what to think of this.
I was hoping that someone who knows about these things would reply, but no such luck. Does it matter if you put the argument into a variable before calling getRef()?
I don't really see what would be special about one particular instance of something->getRef(something->size() - n) when it encountered others earlier without protest, why it would (seemingly) remember that it was given (this->num - n) this one time...
The problem might be that due to inlining this becomes: assert (this->num - 1 >= 0 && this->num - 1 < this->num); Which looks odd to the compiler. I have no idea how to silence gcc. Perhaps we should just ignore that warning.... Cheers, Johannes