0

Is this warning about name length always harmless? If not, how do I know if I'm in trouble?

One lovely thing in C++ type manging is when name length is exceeded. The linked question shows how to turn it off. I am using Visual C++ 2008 with Boost 1.53.

However as this is the first time I have encountered this templated and typedef type name limit being reached, and I am using Visual C++ 2008, I want to make sure I am not making a mistake or doing something that could be avoided.

Here are my typedefs:

// second half of the value type's std::pair is a struct:

typedef struct _DATA_AREA_DESC
{ 
    // stuff in here doesn't matter, omitted.

} AreaMappedType; 

// key for the map is a string. need to define the type and its allocator. std::string is not suitable on this compiler+standard-library implementation (VC++2008)

typedef boost::interprocess::allocator<char, boost::interprocess::managed_shared_memory::segment_manager> CharAllocator; 
typedef boost::interprocess::basic_string<char, std::char_traits<char>, CharAllocator> AreaKeyType;   


// AreaMap is a map<AreaKeyType,AreaMappedType>


typedef std::pair<const AreaKeyType, AreaMappedType> AreaValueType;

typedef boost::interprocess::allocator<AreaValueType, boost::interprocess::managed_shared_memory::segment_manager> AreaShmemAllocator;

typedef boost::interprocess::map<AreaKeyType, AreaMappedType, std::less<AreaKeyType>, AreaShmemAllocator> AreaMap;

A snippet of the disgustingly long, unreadable warning details text:

1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility(48) : warning C4503: 'std::pair<_Ty1,_Ty2>::pair' : decorated name length exceeded, name was truncated
1>        with
1>        [
1>            _Ty1=boost::intrusive::tree_iterator<boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>,boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>,true>,normal_link,boost::intrusive::default_tag,3>,boost::container::container_detail::node_compare<boost::container::container_detail::tree_value_compare<AreaKeyType,std::pair<const AreaKeyType,AreaMappedType>,std::less<AreaKeyType>,boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>>,boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>>,unsigned int,true>>,false>,
1>            _Ty2=bool
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\container\detail\tree.hpp(750) : see reference to class template instantiation 'std::pair<_Ty1,_Ty2>' being compiled
1>        with
1>        [
1>            _Ty1=boost::intrusive::tree_iterator<boost::intrusive::rbtree_impl<boost::intrusive::setopt<boost::intrusive::detail::base_hook_traits<boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>,boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>,true>,normal_link,boost::intrusive::default_tag,3>,boost::container::container_detail::node_compare<boost::container::container_detail::tree_value_compare<AreaKeyType,std::pair<const AreaKeyType,AreaMappedType>,std::less<AreaKeyType>,boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>>,boost::container::container_detail::rbtree_node<std::pair<const AreaKeyType,AreaMappedType>,boost::interprocess::offset_ptr<void>>>,unsigned int,true>>,false>,
1>            _Ty2=bool
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\container\detail\tree.hpp(749) : while compiling class template member function 'std::pair<_Ty1,_Ty2> boost::container::container_detail::rbtree<Key,Value,KeyOfValue,KeyCompare,A>::insert_unique_check(const boost::container::basic_string<CharT,Traits,Allocator> &,boost::intrusive::detail::tree_algorithms<NodeTraits>::insert_commit_data &)'
1>        with
1>        [
1>            _Ty1=boost::container::container_detail::rbtree<AreaKeyType,std::pair<const AreaKeyType,AreaMappedType>,boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>,std::less<AreaKeyType>,AreaShmemAllocator>::iterator,
1>            _Ty2=bool,
1>            Key=AreaKeyType,
1>            Value=std::pair<const AreaKeyType,AreaMappedType>,
1>            KeyOfValue=boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>,
1>            KeyCompare=std::less<AreaKeyType>,
1>            A=AreaShmemAllocator,
1>            CharT=char,
1>            Traits=std::char_traits<char>,
1>            Allocator=CharAllocator,
1>            NodeTraits=boost::intrusive::rbtree_node_traits<boost::interprocess::offset_ptr<void>,true>
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\container\map.hpp(82) : see reference to class template instantiation 'boost::container::container_detail::rbtree<Key,Value,KeyOfValue,KeyCompare,A>' being compiled
1>        with
1>        [
1>            Key=AreaKeyType,
1>            Value=std::pair<const AreaKeyType,AreaMappedType>,
1>            KeyOfValue=boost::container::container_detail::select1st<std::pair<const AreaKeyType,AreaMappedType>>,
1>            KeyCompare=std::less<AreaKeyType>,
1>            A=AreaShmemAllocator
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\type_traits\is_abstract.hpp(72) : see reference to class template instantiation 'boost::container::map<Key,T,Compare,Allocator>' being compiled
1>        with
1>        [
1>            Key=AreaKeyType,
1>            T=AreaMappedType,
1>            Compare=std::less<AreaKeyType>,
1>            Allocator=AreaShmemAllocator
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\type_traits\is_abstract.hpp(144) : see reference to class template instantiation 'boost::detail::is_abstract_imp<T>' being compiled
1>        with
1>        [
1>            T=AreaMap
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\mpl\aux_\preprocessed\plain\or.hpp(51) : see reference to class template instantiation 'boost::is_abstract<T>' being compiled
1>        with
1>        [
1>            T=AreaMap
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\mpl\if.hpp(63) : see reference to class template instantiation 'boost::mpl::or_<T1,T2>' being compiled
1>        with
1>        [
1>            T1=boost::is_abstract<AreaMap>,
1>            T2=boost::is_array<AreaMap>
1>        ]
1>        c:\dev\boost\boost_1_53_0\boost\foreach.hpp(489) : see reference to class template instantiation 'boost::mpl::if_<T1,T2,T3>' being compiled
1>        with
1>        [
1>            T1=boost::mpl::or_<boost::is_abstract<AreaMap>,boost::is_array<AreaMap>>,
1>            T2=boost::foreach_detail_::rvalue_probe<AreaMap>::private_type_,
1>            T3=AreaMap
1>        ]
1>        c:\dev\dnp3_driver_2008r2\osdk\libraries\memory20\ed3drvmemory.cpp(229) : see reference to class template instantiation 'boost::foreach_detail_::rvalue_probe<T>' being compiled
1>        with
1>        [
1>            T=AreaMap
1>        ]
1>c:\program files (x86)\microsoft visual studio 9.0\vc\include\utility(48) : warning C4503: 'std::pair<_Ty1,_Ty2>::pair' : decorated name length exceeded, name was truncated
1>        with
1>        [
1>            

Could this be fixed? Did I make a rookie mistake?

Community
  • 1
  • 1
Warren P
  • 65,725
  • 40
  • 181
  • 316
  • According to MSDN, "the correctness of the program, however, is unaffected by the truncated name" (http://msdn.microsoft.com/en-us/library/074af4b6(v=vs.100).aspx). – Igor R. Apr 13 '13 at 16:18
  • just curious: if you are using the latest and greatest Boost version (1.53), why not upgrade to Visual Studio 2012? – TemplateRex Apr 13 '13 at 16:30
  • It's a legacy codebase that I managed to get ported up from VC++ 6.0 to 2008 just this week. I was planning to stabilize it in 2008 before I attempt a later dialect of C++ with this ancient code. – Warren P Apr 13 '13 at 16:57
  • I understand your strategy, but you do not need to use the C++11 features from VC 2012. The problem with taking the VC 2008 "detour" is that you are matching its bugs as well. It's probably safer directly go to C++98 dialect of VC 2012, and then upgrade to C++11 (if you even want that of course). – TemplateRex Apr 13 '13 at 18:49
  • What's wrong with the answer to the other question? Theoretically you can have some problems debugging if two symbols are identical for the first 4096 characters. But if they are, you will have huge problems already, not only in the debugger. Just disable the warning! – Bo Persson Apr 13 '13 at 20:01
  • rhalbersma : Sadly, I think you're right. I am seriously considering ditching VC++2008 immediately. – Warren P Apr 14 '13 at 18:34

0 Answers0