这是 cppcheck show warning "[event.cpp:20]: (performance) Function parameter 'path' should be pass by reference." 的代码。
void
event::set_path(const std::string path)
{
this->_path = path;
}
但包括字符串参数在内的其他代码不会显示此警告,例如:
int
watcher::init_watch(const struct stat *sb, std::string path, bool linked)
{
int wd;
....
}
为什么?