我在CppLint上得到了这个错误:
Using C-style cast. Use reinterpret_cast<xmlChar *>(...) instead [readability/casting] [4]当我尝试使用这样的类型时:
xmlChar* something = (xmlChar*) anOtherThing;但如果我这么做了:
xmlChar* something = reinterpret_cast<xmlChar *>(anOtherThing);我在构建时出现了这个错误:
error: reinterpret_cast from type ‘const char*’ to type ‘xmlChar*’ casts away constness你能帮我个忙吗?
发布于 2018-08-06 22:21:53
因此,解决方案是将xmlChar*替换为const xmlChar*,就像Vivick说的那样。
但是,如果我们像我一样使用xmlChar*,我们可以使用函数xmlChartStrdup()而不是重新解释(),并且它避免了将所有代码更改为put const。
感谢所有人
https://stackoverflow.com/questions/51708945
复制相似问题