3 ms·
It is easily made a hard error using -Werror, or you can even just make this an error if you don't want all warnings to be errors: clang++ test.cc -std=c++17
by DannyBee 4y ago
It is easily made a hard error using -Werror, or you can even just make this an error if you don't want all warnings to be errors:
clang++ test.cc -std=c++17 -Werror=dangling-gsl.
test.cc:7:29: error: object backing the pointer will be
destroyed at the end of the full-expression [-Werror,-
Wdangling-gsl]
std::string_view sv = s + "World\n";
^~~~~~~~~~~~~
It is pretty standard in large codebases in any language to carefully choose sets of warnings and errors.
I do think Rust has lots to offer, but i think the eternal argument here about what the compiler lets you do vs not is not likely to be a winning one with the C++ developers you see who don't want to move over.