我的代码中有一个循环使用std::basic_string<HANDLE>,然后像这样等待它:
DWORD dwWaitResult = WaitForMultipleObjects((DWORD)handles.size(),
handles.data(),
FALSE, POLL_INTERVAL_MS);
Run Code Online (Sandbox Code Playgroud)
它工作正常,但是当我打开/ W4和/ analyze时,Visual C++ 2008会发出以下警告(为简洁而减少并包装):
iosfwd(266) : warning C6001: Using uninitialized memory '*_First'
iosfwd(262) : while compiling class template member function
'HANDLE *std::char_traits<_Elem>::assign(_Elem *,size_t,_Elem)'
with [ _Elem=HANDLE ]
xstring(2155) : see reference to class template instantiation
'std::char_traits<_Elem>' being compiled
with [ _Elem=HANDLE ]
xstring(2148) : while compiling class template member function
'void std::basic_string<_Elem>::_Tidy(bool,unsigned int)'
with [ _Elem=HANDLE ]
.\MyCode.cpp(231) : see reference to class template instantiation
'std::basic_string<_Elem>' being compiled
with [ _Elem=HANDLE ]
iosfwd(222) : warning C6001: Using uninitialized memory '*_First1'
iosfwd(216) : while compiling class template member function
'HANDLE *std::char_traits<_Elem>::_Copy_s
(_Elem *,size_t,const _Elem *,size_t)'
with [ _Elem=HANDLE ]
Run Code Online (Sandbox Code Playgroud)
问题:
char或wchar_t)的东西是否合法?#pragma warning(disable)需要证明理由.考虑到Boost已经出局,我们将获得额外的荣誉,我们仅限于Visual C++ 2008中的STL实现; 允许TR1的Visual C++位.