std::string
to C-style string CXX-C2024Found conversion of a std::string
to a C-style string using the c_str()
or `data() methods. This is unnecessary and can lead to potential memory issues while also being less efficient.
To fix this issue, use std::string
directly without converting it to a C-style string.
std::string foo(std::string str);
void bar(void {
std::string pass;
foo(pass.c_str());
foo(pass.data());
}
std::string foo(std::string str);
void bar(void {
std::string pass;
foo(pass);
foo(pass);
}