1>c:\programfiles\microsoftvisualstudio10.0\vc\include\map(229):warningC4180:qualifierappliedtofunctiontypehasnomeaning;ignored1>d:\...\gmproject.h(122):seereferencetoclasstemplateinstantiation'std::map'beingcompiled1>with1>[1>_Kty=GMProject::DuplicateTy,1>_Ty=GMProject::DuplicateFn1>]我的类有这些type
我已经设置了编译器/Za选项来禁用语言扩展,以便编译器严格使用标准ISOC++。这是我收到以下警告的示例接口(interface)类warningC4180:qualifierappliedtofunctiontypehasnomeaning;ignored这是关于函数返回类型中的const限定符,如果我删除const,警告就会消失,但我不想这样做,我想重新启用lanqage扩展。我的问题是:这个警告合理吗?如果不是,那么我将使用pragma禁用警告,但在此之前我想确保此警告是“误报”因为下面的类是正确的ANSIISOC++不是吗?所以警告应该被禁用?classIBet{public:
这个问题在这里已经有了答案:ShouldIreturnconstobjects?(12个答案)关闭9年前。structCCompare{constbooloperator()(constint&lhs,constint&rhs)const{returnlhsWarning1warningC4180:qualifierappliedtofunctiontypehasnomeaning;我在一本编程书上看到返回值为constbool的用法。我用vs2010编译上面的代码,报C4180警告。下面的代码不会引起同样的警告。structCCompare{booloperator()(consti