【发布时间】:2021-02-23 17:26:27
【问题描述】:
在我的代码上运行 CppCheck 的输出显示以下错误:
Variable 'strFullPath' is assigned a value that is never used. [unreadVariable]
下面的方法是讨论中的方法。
void DebugLogging::GetDebugLogSettings(const std::string& sAppProfile)
{
std::string strFullPath = ROOT_KEY_NAME + sAppProfile;
#ifdef _WIN32
std::string strFullPathLocal = strFullPath + "Local";
#else
std::string sAppProfileLocal = sAppProfile + "Local";
std::ifstream settingsLocalfile(sAppProfileLocal.c_str());
#endif
}
CppCheck 声明strFullPath 的值从未使用过。但是,它在宏内部使用。
如何设置 CppCheck 使其能够发现变量的使用情况?
【问题讨论】:
标签: cppcheck