Archived

This topic is now archived and is closed to further replies.

Gabriel Fleseriu

std::vector - a bunch of compiler warnings

Recommended Posts

I have practically no experience w/ STL, and thought "let's get a grip on it". So I thought I'd just start small, and have written a piece of code. I have both the M$ and Silicon Graphics' implementation of STL. Working with VC++6.0 Pro SP5 on Win2k. As you can see, this little piece of code gives me **many** warnings with both implementations. Btw, if I change the line
  
typedef vector<int> t_int_vector;  
// to 

typedef vector<int, allocator<int> > t_int_vector; 
   
The SGI implementation gives me an INTERNAL COMPILER ERROR. The M$ implementation still gives me the bunch of warnings. I've searched the net, and also tried to compile some samples from MSDN, but the bunch of warnings (more or less) remains the same. Any idea what I'm doing wrong? TIA. Here the code (and the warnings)
    
#pragma warning(disable:4786)

#include <vector> 
using namespace std;

typedef vector<int> t_int_vector; 

void main()
{
	int i = 1;
	t_int_vector the_vector;
	the_vector.push_back(i);
}  

/* Using M$ STL:
--------------------Configuration: console - Win32 Debug--------------------
Compiling...
console.cpp
c:\programme\microsoft visual studio\vc98\include\xmemory(39) : warning C4100: '_P' : unreferenced formal parameter
c:\programme\microsoft visual studio\vc98\include\xmemory(41) : warning C4100: '_P' : unreferenced formal parameter
c:\programme\microsoft visual studio\vc98\include\vector(249) : warning C4663: C++ language change: to explicitly specialize class template 'vector' use the following syntax:
        template<> class vector<bool,class std::allocator<unsigned int> > ...
c:\programme\microsoft visual studio\vc98\include\vector(156) : warning C4018: '<' : signed/unsigned mismatch
        c:\programme\microsoft visual studio\vc98\include\vector(156) : while compiling class-template member function 'void __thiscall std::vector<unsigned int,class std::allocator<unsigned int> >::insert(unsigned int *,unsigned int,const unsigned 
int &)'
c:\programme\microsoft visual studio\vc98\include\vector(167) : warning C4018: '<' : signed/unsigned mismatch
        c:\programme\microsoft visual studio\vc98\include\vector(156) : while compiling class-template member function 'void __thiscall std::vector<unsigned int,class std::allocator<unsigned int> >::insert(unsigned int *,unsigned int,const unsigned 
int &)'
c:\programme\microsoft visual studio\vc98\include\vector(156) : warning C4018: '<' : signed/unsigned mismatch
        c:\programme\microsoft visual studio\vc98\include\vector(156) : while compiling class-template member function 'void __thiscall std::vector<int,class std::allocator<int> >::insert(int *,unsigned int,const int &)'
c:\programme\microsoft visual studio\vc98\include\vector(167) : warning C4018: '<' : signed/unsigned mismatch
        c:\programme\microsoft visual studio\vc98\include\vector(156) : while compiling class-template member function 'void __thiscall std::vector<int,class std::allocator<int> >::insert(int *,unsigned int,const int &)'
c:\programme\microsoft visual studio\vc98\include\xstring(600) : warning C4245: 'initializing' : conversion from 'const int' to 'const unsigned int', signed/unsigned mismatch
        c:\programme\microsoft visual studio\vc98\include\xmemory(59) : while compiling class-template static data member 'const unsigned int std::basic_string<char,std::char_traits<char>,std::allocator<char> >::npos'
c:\programme\microsoft visual studio\vc98\include\xmemory(37) : warning C4100: '_P' : unreferenced formal parameter
        c:\programme\microsoft visual studio\vc98\include\xmemory(68) : see reference to function template instantiation 'void __cdecl std::_Destroy(unsigned int *)' being compiled
c:\programme\microsoft visual studio\vc98\include\xmemory(37) : warning C4100: '_P' : unreferenced formal parameter
        c:\programme\microsoft visual studio\vc98\include\xmemory(68) : see reference to function template instantiation 'void __cdecl std::_Destroy(int *)' being compiled

console.obj - 0 error(s), 10 warning(s)
*/

/* Using Silicon Graphics' STL:
--------------------Configuration: console - Win32 Debug--------------------
Compiling...
console.cpp
c:\stl\string(295) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(373) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(374) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(375) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(376) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(377) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(378) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(380) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(381) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(382) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<_CharT,_Traits,_Alloc>::_String_base<_Tp,`template-parameter259'>'
        c:\stl\string(1092) : see reference to class template instantiation 'std::basic_string<_CharT,_Traits,_Alloc>' being compiled
c:\stl\string(295) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(373) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(374) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(375) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(376) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(377) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(378) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(380) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(381) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(382) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(2357) : see reference to class template instantiation 'std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\stl_vector.h(174) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<_Tp,_Alloc>::_Vector_base<_Tp,_Alloc>'
        c:\stl\stl_vector.h(496) : see reference to class template instantiation 'std::vector<_Tp,_Alloc>' being compiled
c:\stl\stl_vector.h(189) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<_Tp,_Alloc>::_Vector_base<_Tp,_Alloc>'
        c:\stl\stl_vector.h(496) : see reference to class template instantiation 'std::vector<_Tp,_Alloc>' being compiled
c:\stl\stl_vector.h(190) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<_Tp,_Alloc>::_Vector_base<_Tp,_Alloc>'
        c:\stl\stl_vector.h(496) : see reference to class template instantiation 'std::vector<_Tp,_Alloc>' being compiled
c:\stl\stl_vector.h(191) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<_Tp,_Alloc>::_Vector_base<_Tp,_Alloc>'
        c:\stl\stl_vector.h(496) : see reference to class template instantiation 'std::vector<_Tp,_Alloc>' being compiled
c:\stl\stl_vector.h(192) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<_Tp,_Alloc>::_Vector_base<_Tp,_Alloc>'
        c:\stl\stl_vector.h(496) : see reference to class template instantiation 'std::vector<_Tp,_Alloc>' being compiled
c:\stl\stl_vector.h(193) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<_Tp,_Alloc>::_Vector_base<_Tp,_Alloc>'
        c:\stl\stl_vector.h(496) : see reference to class template instantiation 'std::vector<_Tp,_Alloc>' being compiled
c:\stl\stl_vector.h(174) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<int,class std::__default_alloc_template<0,0> >::_Vector_base<int,class std::__default_alloc_template<0,0> >'
        c:\test\console\console.cpp(11) : see reference to class template instantiation 'std::vector<int,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\stl_vector.h(189) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<int,class std::__default_alloc_template<0,0> >::_Vector_base<int,class std::__default_alloc_template<0,0> >'
        c:\test\console\console.cpp(11) : see reference to class template instantiation 'std::vector<int,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\stl_vector.h(190) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<int,class std::__default_alloc_template<0,0> >::_Vector_base<int,class std::__default_alloc_template<0,0> >'
        c:\test\console\console.cpp(11) : see reference to class template instantiation 'std::vector<int,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\stl_vector.h(191) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<int,class std::__default_alloc_template<0,0> >::_Vector_base<int,class std::__default_alloc_template<0,0> >'
        c:\test\console\console.cpp(11) : see reference to class template instantiation 'std::vector<int,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\stl_vector.h(192) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<int,class std::__default_alloc_template<0,0> >::_Vector_base<int,class std::__default_alloc_template<0,0> >'
        c:\test\console\console.cpp(11) : see reference to class template instantiation 'std::vector<int,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\stl_vector.h(193) : warning C4097: typedef-name '_Base' used as synonym for class-name 'vector<int,class std::__default_alloc_template<0,0> >::_Vector_base<int,class std::__default_alloc_template<0,0> >'
        c:\test\console\console.cpp(11) : see reference to class template instantiation 'std::vector<int,class std::__default_alloc_template<0,0> >' being compiled
c:\stl\string(327) : warning C4097: typedef-name '_Base' used as synonym for class-name '_String_base<char,class std::__default_alloc_template<0,0> >'
        c:\stl\string(324) : while compiling class-template member function '__thiscall std::basic_string<char,class std::char_traits<char>,class std::__default_alloc_template<0,0> >::std::basic_string<char,class std::char_traits<char>,class std::__
default_alloc_template<0,0> >(const char *,const class std::__default_alloc_template<0,0> &)'
c:\stl\stl_vector.h(239) : warning C4097: typedef-name '_Base' used as synonym for class-name '_Vector_base<int,class std::__default_alloc_template<0,0> >'
        c:\stl\stl_vector.h(239) : while compiling class-template member function '__thiscall std::vector<int,class std::__default_alloc_template<0,0> >::std::vector<int,class std::__default_alloc_template<0,0> >(const class std::__default_alloc_tem
plate<0,0> &)'
c:\stl\stl_algobase.h(107) : warning C4127: conditional expression is constant
        c:\stl\stl_algobase.h(606) : see reference to function template instantiation 'const unsigned int &__cdecl std::min(const unsigned int &,const unsigned int &)' being compiled
c:\stl\stl_algobase.h(566) : warning C4127: conditional expression is constant
        c:\stl\stl_algobase.h(617) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(const signed char *,const signed char *,const signed char *,const signed char *)' being compiled
c:\stl\stl_algobase.h(567) : warning C4127: conditional expression is constant
        c:\stl\stl_algobase.h(617) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(const signed char *,const signed char *,const signed char *,const signed char *)' being compiled
c:\stl\stl_algobase.h(568) : warning C4127: conditional expression is constant
        c:\stl\stl_algobase.h(617) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(const signed char *,const signed char *,const signed char *,const signed char *)' being compiled
c:\stl\stl_algobase.h(570) : warning C4127: conditional expression is constant
        c:\stl\stl_algobase.h(617) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(const signed char *,const signed char *,const signed char *,const signed char *)' being compiled
c:\stl\stl_algobase.h(107) : warning C4127: conditional expression is constant
        c:\stl\stl_algobase.h(654) : see reference to function template instantiation 'const int &__cdecl std::min(const int &,const int &)' being compiled
c:\stl\string(295) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(373) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(374) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(375) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(376) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(377) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(378) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(380) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(381) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\string(382) : warning C4097: typedef-name '_Base' used as synonym for class-name 'basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >::_String_base<unsigned short,class std::__default_
alloc_template<0,0> >'
        c:\stl\string(2376) : see reference to class template instantiation 'std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> >' being compiled
        c:\stl\string(2400) : see reference to function template instantiation 'unsigned int __cdecl std::__stl_string_hash(const class std::basic_string<unsigned short,class std::char_traits<unsigned short>,class std::__default_alloc_template<0,0> 
> &)' being compiled
c:\stl\stl_algobase.h(443) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(542) : see reference to function template instantiation 'void __cdecl std::fill(unsigned int *,unsigned int *,const int &)' being compiled
c:\stl\stl_iterator_base.h(287) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(589) : see reference to function template instantiation 'void __cdecl std::distance(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,unsigned int &)' being compiled
c:\stl\stl_iterator_base.h(287) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(598) : see reference to function template instantiation 'void __cdecl std::distance(const bool *,const bool *,unsigned int &)' being compiled
c:\stl\stl_algobase.h(91) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(702) : see reference to function template instantiation 'void __cdecl std::swap(struct std::_Bit_iterator &,struct std::_Bit_iterator &)' being compiled
c:\stl\stl_algobase.h(91) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(704) : see reference to function template instantiation 'void __cdecl std::swap(unsigned int *& ,unsigned int *& )' being compiled
c:\stl\stl_algobase.h(113) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(750) : see reference to function template instantiation 'const unsigned int &__cdecl std::max(const unsigned int &,const unsigned int &)' being compiled
c:\stl\stl_algobase.h(443) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(787) : see reference to function template instantiation 'void __cdecl std::fill(struct std::_Bit_iterator,struct std::_Bit_iterator,const bool &)' being compiled
c:\stl\stl_algobase.h(450) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(794) : see reference to function template instantiation 'struct std::_Bit_iterator __cdecl std::fill_n(struct std::_Bit_iterator,unsigned int,const bool &)' being compiled
c:\stl\stl_algobase.h(536) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(846) : see reference to function template instantiation 'bool __cdecl std::equal(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator)' being compiled
c:\stl\stl_algobase.h(537) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(846) : see reference to function template instantiation 'bool __cdecl std::equal(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator)' being compiled
c:\stl\stl_algobase.h(538) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(846) : see reference to function template instantiation 'bool __cdecl std::equal(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator)' being compiled
c:\stl\stl_algobase.h(540) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(846) : see reference to function template instantiation 'bool __cdecl std::equal(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator)' being compiled
c:\stl\stl_algobase.h(566) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(859) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_it
erator)' being compiled
c:\stl\stl_algobase.h(567) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(859) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_it
erator)' being compiled
c:\stl\stl_algobase.h(568) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(859) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_it
erator)' being compiled
c:\stl\stl_algobase.h(570) : warning C4127: conditional expression is constant
        c:\stl\stl_bvector.h(859) : see reference to function template instantiation 'bool __cdecl std::lexicographical_compare(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,struct std::_Bit_const_it
erator)' being compiled
c:\stl\stl_iterator_base.h(279) : warning C4127: conditional expression is constant
        c:\stl\stl_iterator_base.h(288) : see reference to function template instantiation 'void __cdecl std::__distance(struct std::_Bit_const_iterator,struct std::_Bit_const_iterator,unsigned int &,struct std::random_access_iterator_tag)' being co
mpiled
c:\stl\stl_iterator_base.h(279) : warning C4127: conditional expression is constant
        c:\stl\stl_iterator_base.h(288) : see reference to function template instantiation 'void __cdecl std::__distance(const bool *,const bool *,unsigned int &,struct std::random_access_iterator_tag)' being compiled
c:\stl\stl_construct.h(57) : warning C4100: '__pointer' : unreferenced formal parameter
        c:\stl\stl_construct.h(110) : see reference to function template instantiation 'void __cdecl std::_Destroy(char *)' being compiled

console.obj - 0 error(s), 69 warning(s)
*/
    
[edit] darn tags.... Forever trusting who we are And nothing else matters - Metallica [edited by - Gabriel Fleseriu on April 29, 2002 9:56:14 AM]

Share this post


Link to post
Share on other sites
Those warnings are mainly down to deficiencies of MSVC++6, and are something you''ll have to live with while you use that compiler. The best thing to do is probably to turn off the "gibberish" warnings so that you can concentrate on the ones that are more useful.


[C++ FAQ Lite | ACCU | Boost | Python]

Share this post


Link to post
Share on other sites
Sabre: Thx for the answer. Do you mean that those warnings are normal ?! (Or with other words, VC++6.0 is that f***ed up?) A principle I try to respect is to write code that compiles "clean". And when I disabple a warning with a #pragma, I want to exactly know what I''m doing.

What do you do? Do you simply ignore them?

Forever trusting who we are
And nothing else matters
- Metallica

Share this post


Link to post
Share on other sites
Hmm you must have one messed up installation. I compiled your code snippet with both Dinkumware''s STL (the one that comes with VC6) and the STL Port version. No errors.

Judging by your errors it appears you haven''t installed the SGI implementation correctly. You probably should be using STL Port which is based on the SGI implementation but much more compiler friendly.

Still, the code compiles fine for me, no idea what you are doing wrong...

Dire Wolf
www.digitalfiends.com

Share this post


Link to post
Share on other sites
Wolf: the code doesn''t give errors, but just warnings. If the installation wasn''t correct (what could you do wrong here?), the code wouldn''t compile at all.

Sabre: seems to be no way around this, altough I don''t like it.

Thank you both.

Forever trusting who we are
And nothing else matters
- Metallica

Share this post


Link to post
Share on other sites
Hehe sorry I meant warnings; I don't get any warnings when compiling those samples. Then again, I don't use SGI's STL implementation directly. I use an STL implementation that is based on SGIs called STL Port. STL Port is more compatible with various compilers than SGIs implementation.

It is true that VC6 is not fully compliant with the C++ standard. The lack of proper template support is frustrating but only gets really annoying when you start to work with complex template code. On average you shouldn't get any warnings when using templates. If you start messing with partial specialization...VC does get a bit picky.

Dire Wolf
www.digitalfiends.com

EDIT: It looks as though your VC6 STL installation might be old/corrupted. Try reapplying SP5 again and see if that helps. I believe SP5 (which contains the previous service packs) updates a few of the STL headers.

[edited by - Dire.Wolf on April 29, 2002 11:03:16 AM]

Share this post


Link to post
Share on other sites
Wolf: thx for pointing me to STLPort. The code compiles fine and gives only
warning C4514: ''xxxxxxxx'' : unreferenced inline function has been removed
wich is safe to ignore

You made a man happy today

Forever trusting who we are
And nothing else matters
- Metallica

Share this post


Link to post
Share on other sites