g++ -Wall会有警告
gcc 8.3.0没警告,12.x有警告
happy@UOS-128G:~$ /opt/cross/bin/x86_64-linux-musl-g++ -static -Wall 1.cpp
1.cpp: In function ‘std::vector<std::__cxx11::basic_string<char> >&& get_cmp_files(const std::string&)’:
1.cpp:22:22: warning: reference to local variable ‘res’ returned [-Wreturn-local-addr]
22 | return std::move(res);
| ~~~~~~~~~^~~~~
1.cpp:9:31: note: declared here
9 | std::vector<std::string> res;
| ^~~
【 在 hl0737 的大作中提到: 】
: std::vector<std::string>&& get_cmp_files(const std::string& dir) {
: std::vector<std::string> res;
: DIR* dp;
: ...................
--
FROM 123.118.191.*