warning: comparison of unsigned expression < 0 is always false

212 views
Skip to first unread message

Alec Clews

unread,
Nov 9, 2012, 5:09:17 PM11/9/12
to ppp-p...@googlegroups.com
I'm getting the following warnings

../std_lib_facilities.h:112:8: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                if (i<0||size()<=i) throw Range_error(i);
                    ~^~
../std_lib_facilities.h:118:8: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare]
                if (i<0||size()<=i) throw Range_error(i);
                    ~^~

Which if you look at the code make perfect sense as i is declared unsigned. Is there some reason it's written that way or can I remove the offending test?

Thanks

Art Werschulz

unread,
Nov 10, 2012, 6:43:37 PM11/10/12
to ppp-p...@googlegroups.com
Hi.
You can remove the test.

Art Werschulz (8-{)} "Metaphors be with you." -- bumper sticker
GCS/M (GAT): d? -p+ c++ l u+(-) e--- m* s n+ h f g+ w+ t++ r- y?
Internet: agw STRUDEL comcast.net



Reply all
Reply to author
Forward
0 new messages