The numerous multi line "int" to "bool" performance warnings
Posted: Sun Jan 22, 2012 11:07 pm
Hi all,
Thought I would come out of lurk mode for a second to pose a question.
Has anyone patched the int to bool conversion performance warnings when compiling on vs2010?
Away from my home computer at the moment but I'll post one of the warnings when I'm home. The warning is fifteen to twenty lines and always starts "warning int yada yada yada convert to bool true false performance warning".
the problem I'm having is clicking it doesn't direct you to where the warning is being generated but instead off to what I'm assuming are subfunctions from the trouble maker.
the reason for the warning is fairly straight forward vs2005 evaluating a bool function with int values the compiler now recognizes the implied conversion. to warn the programmer of the conversion performance hit from branching the evaluation well there you go.
I just haven't been able to clear the awful things since they are so uninformative and I'm not exactly spending a ton of time on the problem yet.
ps I'm working with all warnings on as well as w_char as a built in on.
edit: here's the warning, and as you can see it is really uninformative as to where exactly the warning is really being caused compared to other warnings. I have the solution, it's rather well documented, I just havn't got a clue where to apply it.
13>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(163): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
13> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(247) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<std::_Tree_iterator<_Mytree>&,_Ty>(_Other1,_Other2 &&)' being compiled
13> with
13> [
13> _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>>,
13> _Ty2=bool,
13> _Mytree=std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>,
13> _Ty=int,
13> _Other1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>> &,
13> _Other2=int
13> ]
13> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xtree(988) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<std::_Tree_iterator<_Mytree>&,int>(_Other1,_Other2 &&)' being compiled
13> with
13> [
13> _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>>,
13> _Ty2=bool,
13> _Mytree=std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>,
13> _Other1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream
*,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>> &,
13> _Other2=int
13> ]
Thought I would come out of lurk mode for a second to pose a question.
Has anyone patched the int to bool conversion performance warnings when compiling on vs2010?
Away from my home computer at the moment but I'll post one of the warnings when I'm home. The warning is fifteen to twenty lines and always starts "warning int yada yada yada convert to bool true false performance warning".
the problem I'm having is clicking it doesn't direct you to where the warning is being generated but instead off to what I'm assuming are subfunctions from the trouble maker.
the reason for the warning is fairly straight forward vs2005 evaluating a bool function with int values the compiler now recognizes the implied conversion. to warn the programmer of the conversion performance hit from branching the evaluation well there you go.
I just haven't been able to clear the awful things since they are so uninformative and I'm not exactly spending a ton of time on the problem yet.
ps I'm working with all warnings on as well as w_char as a built in on.
edit: here's the warning, and as you can see it is really uninformative as to where exactly the warning is really being caused compared to other warnings. I have the solution, it's rather well documented, I just havn't got a clue where to apply it.
13>C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(163): warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
13> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\utility(247) : see reference to function template instantiation 'std::_Pair_base<_Ty1,_Ty2>::_Pair_base<std::_Tree_iterator<_Mytree>&,_Ty>(_Other1,_Other2 &&)' being compiled
13> with
13> [
13> _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>>,
13> _Ty2=bool,
13> _Mytree=std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>,
13> _Ty=int,
13> _Other1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>> &,
13> _Other2=int
13> ]
13> C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xtree(988) : see reference to function template instantiation 'std::pair<_Ty1,_Ty2>::pair<std::_Tree_iterator<_Mytree>&,int>(_Other1,_Other2 &&)' being compiled
13> with
13> [
13> _Ty1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>>,
13> _Ty2=bool,
13> _Mytree=std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream *,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>,
13> _Other1=std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::wstring,hsStream
*,std::less<std::wstring>,std::allocator<std::pair<const std::wstring,hsStream *>>,false>>> &,
13> _Other2=int
13> ]