我正在使用 rapidxml,所以我想在代码中进行这样的比较:
if ( searchNode->first_attribute("name")->value() == "foo" )
这给出了以下警告:
comparison with string literal results in unspecified behaviour [-Waddress]
将其替换为:
if ( !strcmp(searchNode->first_attribute("name")->value() , "foo") )
哪个没有警告?
后者在我看来很难看,但还有别的吗?