[Interest] Klocwork errors in Qt

Thiago Macieira thiago.macieira at intel.com
Thu Dec 5 00:54:51 CET 2019


On Wednesday, 4 December 2019 14:59:41 PST Giuseppe D'Angelo via Interest 
wrote:
> Let me elaborate: the original claim was that QStringBuilder is
> dangerous. It's not (*). The danger can only happen as a misuse of it
> and it's not inherent to QStringBuilder itself, just like other
> countless things in C++ (e.g. returning a reference to a local variable).

https://alexgaynor.net/2019/apr/21/modern-c++-wont-save-us/

An example:

  std::string s = "Hellooooooooooooooo ";
  std::string_view sv = s + "World\n";
  std::cout << sv;

Same issue (dangling pointer), no "auto" required.
-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products





More information about the Interest mailing list