Understanding Coverity's WRAPPER_ESCAPE Warning
Understanding Coverity’s WRAPPER_ESCAPE Warning Originally published in Chinese on 2020-03-15; this English edition preserves the original scope and technical context. const char* Foo() { std::string str_msg("test"); return str_msg.c_str(); } int main() { const char *p_msg = Foo(); printf("%s\n", p_msg); return 0; } // output: (empty, or garbled) D? | Above code’s Foo function is reported with the coverity warning WRAPPER_ESCAPE. The detailed explanation is as follows:| Above code, the Foo function reports a WRAPPER_ESCAPE warning from Coverity. The issue is detailed as follows: ...