Comparison warning from stl_deque.h

John Yates yates@plutotech.com
Mon Oct 12 13:54:00 GMT 1998


The following program produces a warning about comparing signed and
unsigned quantities.

------------------- stl.cc -----------------------
#include <deque>

main()
{
	deque<char *>	aDeque;

	aDeque.erase(aDeque.begin(), aDeque.end());
}
-----------------------------------------------------

when compiled with "g++ -O -Wall -c stl.cc".

The compiler output is

---------------------------------------------------------
yates@titanic$ g++ -v -O -Wall -c stl.cc
Reading specs from
/usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.92.07/specs
gcc version egcs-2.92.07 19980914 (gcc2 ss-980609 experimental)
 /usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.92.07/cpp -lang-c++
-v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=92
-Dunix -Di386 -D__FreeBSD__=3 -D__unix__ -D__i386__ -D__FreeBSD__=3
-D__unix -D__i386 -Asystem(unix) -Asystem(FreeBSD) -Acpu(i386)
-Amachine(i386) -D__EXCEPTIONS -D__OPTIMIZE__ -Wall -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ stl.cc /var/tmp/ccGhmjzg.ii
GNU CPP version egcs-2.92.07 19980914 (gcc2 ss-980609 experimental)
(80386, BSD syntax)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.92.07/include/g++
 /usr/local/include
 /usr/local/i386-unknown-freebsd/include
 /usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.92.07/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.92.07/cc1plus
/var/tmp/ccGhmjzg.ii -quiet -dumpbase stl.cc -O -Wall -version -o
/var/tmp/ccNF9dPE.s
GNU C++ version egcs-2.92.07 19980914 (gcc2 ss-980609 experimental)
(i386-unknown-freebsd) compiled by GNU C version egcs-2.92.07 19980914
(gcc2 ss-980609 experimental).
/usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.92.07/include/g++/stl_deque.h:
In method `struct _Deque_iterator<char *,char *&,char **,0> deque<char
*,allocator<char *>,0>::erase(struct _Deque_iterator<char *,char *&,char
**,0>, struct _Deque_iterator<char *,char *&,char **,0>)':
stl.cc:7:   instantiated from here
/usr/local/lib/gcc-lib/i386-unknown-freebsd/egcs-2.92.07/include/g++/stl_deque.h:1051:
warning: comparison between signed and unsigned
 as -o stl.o /var/tmp/ccNF9dPE.s
yates@titanic$ 
---------------------------------------------------------

Thanks,
John

-- 
John Yates				(303)402-9000 x169
Pluto Technologies International, Inc.
2511 55th Street
Boulder, Colorado 80301



More information about the Gcc-bugs mailing list