bug in stl library include files.
Rob Browning
rlb@cs.utexas.edu
Fri Feb 13 17:40:00 GMT 1998
"Brad M. Garcia" <bgarcia@fore.com> writes:
> A caste probably needs to be made within this include file before
> comparing:
> include/g++/stl_deque.h:638: warning: comparison between signed and unsigned
If anyone's interested, here's a patch against 980205 that eliminates
all the warnings of this type that I've seen. I'm no STL internals
expert, but this seems OK as long as the original code is OK:
--- /usr/local/egcs/include/g++/stl_deque.h~ Mon Feb 9 17:11:48 1998
+++ /usr/local/egcs/include/g++/stl_deque.h Tue Feb 10 02:01:38 1998
@@ -635,7 +635,7 @@
}
void reserve_map_at_front (size_type nodes_to_add = 1) {
- if (nodes_to_add > start.node - map)
+ if (nodes_to_add > size_type(start.node - map))
reallocate_map(nodes_to_add, true);
}
@@ -744,7 +744,7 @@
else {
difference_type n = last - first;
difference_type elems_before = first - start;
- if (elems_before < (size() - n) / 2) {
+ if (elems_before < difference_type((size() - n) / 2)) {
copy_backward(start, first, last);
iterator new_start = start + n;
destroy(start, new_start);
@@ -1056,7 +1056,7 @@
{
const difference_type elems_before = pos - start;
size_type length = size();
- if (elems_before < length / 2) {
+ if (elems_before < difference_type(length / 2)) {
iterator new_start = reserve_elements_at_front(n);
iterator old_start = start;
pos = start + elems_before;
--
Rob Browning <rlb@cs.utexas.edu>
PGP fingerprint = E8 0E 0D 04 F5 21 A0 94 53 2B 97 F5 D6 4E 39 30
More information about the Gcc-bugs
mailing list