0

这个关于名称长度的警告是否总是无害的?如果没有,我怎么知道我是否有麻烦?

C++ 类型管理中的一件可爱的事情是超过名称长度时。 链接的问题显示了如何将其关闭。我正在使用带有 Boost 1.53 的 Visual C++ 2008。

然而,由于这是我第一次遇到这种模板化和 typedef 类型名称限制,而且我使用的是 Visual C++ 2008,我想确保我没有犯错或做一些可以避免的事情。

这是我的类型定义:

// 值类型的 std::pair 的后半部分是一个结构体:

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

} AreaMappedType; 

// 地图的键是一个字符串。需要定义类型及其分配器。std::string 不适用于此编译器+标准库实现 (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;

一段长得令人作呕、难以阅读的警告详细信息:

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>            

这可以解决吗?我犯了菜鸟的错误吗?

4

0 回答 0