This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/2923: signed/unsigned comparison in stringbuf::sync()
- To: gcc-gnats at gcc dot gnu dot org
- Subject: libstdc++/2923: signed/unsigned comparison in stringbuf::sync()
- From: jakob at unthought dot net
- Date: 24 May 2001 10:49:55 -0000
- Reply-To: jakob at unthought dot net
>Number: 2923
>Category: libstdc++
>Synopsis: signed/unsigned comparison in stringbuf::sync()
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 24 03:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: jakob@unthought.net
>Release: gcc-2.96(RH), release -81 and others
>Organization:
>Environment:
i686, GNU/Linux
>Description:
I get the warning:
/usr/include/g++-3/sstream: In method `int stringbuf::sync ()':
/usr/include/g++-3/sstream:171: warning: comparison between signed and unsigned integer expressions
Obviously this isn't critical, everything works, it's just annoying.
>How-To-Repeat:
Compile the following file with g++ -Wall:
#include <sstream>
Yes, the only line required is the include of sstream.
>Fix:
buf.size() - rpos (in sstream:171) evaluates to a signed integer. It's compared with n of type streamsize. I guess casting to signed or unsigned would fix this without any impact on any practical uses of the code.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-c++src; name="warn.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="warn.cc"
I2luY2x1ZGUgPHNzdHJlYW0+Cgo=