Mail Archives: djgpp-workers/2001/02/06/02:34:30
There is a simple bug in the STL Libraries that are distributed with DJGPP
V2.03. It only appears depending on which compile time warnings are enabled.
======================
If only the "-Wall" compile warning is turned on, then when using the
<deque> header file,
==== File: test.cpp ======================
#include <deque>
int main()
{
deque<int> _queue; // instantiate an empty queue
_queue.push_back( 10 ); // add an element
if( _queue.size() ) // if any elements, delete 1st
element
{
deque<int>::iterator it = _queue.begin();
_queue.erase( it ); // STL ERROR HERE
}
return 1;
}
Compiling: test.cpp
In method `struct _Deque_iterator<int,int &,int *, 0>
deque<int,allocator<int>,0>::erase(_Deque_iterator<int,int &,int *,0>)':
test.cpp(26) Error: instantiated from here
c:/djgpp/lang/cxx/stl_deque.h(818) Warning: comparison between signed and
unsigned
There were some errors
==========================================
Simple Fix:
In c:/djgpp/lang/cxx/stl_deque.h, line 818 (Last updated in 1997 by Silicon
Graphics Computer Systems, Inc)
Replace:
if( __index < (size() >> 1)) {
With:
if( __index < static_cast<difference_type>(size() >> 1)) {
========================================
Hope this is of some help.
This bug probably also occurs more than once in this file.
========================================
Wayne Donovan
Network Systems - Gaming
phone +61 7 38620317
e-mail <donovan AT tabq DOT com DOT au>
- Raw text -