Hi, I'm quite fed up with integer overflow/wrap. Unsigned integers in particular are particularly dangerous [1]. Last week, I have again fixed a bug related to unsigned int wrap (uint length = 0 - 4, the result of this operation gives a very big number, not zero nor -4)
One friend suggests me to implement an UnsignedInt class, redefining operators, so that it ensures that unsigned never begans negative and launches assertion failure when it happens. Then, we just have to "typedef uint UnsignedInt" instead of "typedef uint unsigned int". Are you ok with that ? (The class may optionnally be used only in debug mode) Regards, Matt (gentildemon) [1] https://www.securecoding.cert.org/confluence/display/cplusplus/INT30-CPP.+Ensure+that+unsigned+integer+operations+do+not+wrap _______________________________________________ Wormux-dev mailing list Wormux-dev@gna.org https://mail.gna.org/listinfo/wormux-dev