3 ms·
> In practice, people writing modern C++ code do not struggle with memory safety, so it has been a good trade. Then why do we have so many memory safety bugs i
by adrianN 4y ago
> In practice, people writing modern C++ code do not struggle with memory safety, so it has been a good trade.
Then why do we have so many memory safety bugs in, for example, modern webbrowsers? I'm relatively sure that the Chrome team is pretty competent, and yet...
- ncmncm 4y agoThe Chrome team is evidently not writing modern C++ code.
- adrianN 4y ago"No true Scotsman...". Take string_view for example: perfectly cromulent modern C++. I use it daily to reduce the number of unnecessary copies. It's also very easy to code a use-after-free bug with it.
- ncmncm 4y agoOnly by storing it somewhere. So long as it is only passed down a call chain, no problem. string_view really is no different from a naked pointer. Modern C++ treats naked pointers with well-deserved suspicion. I never have any trouble because pointers are always strictly evanescent values.