4 ms·
`new` and `delete` have been banned outside of deep library code in every industrial C++ codebase I've ever worked on.
by platinumrad 6y ago
`new` and `delete` have been banned outside of deep library code in every industrial C++ codebase I've ever worked on.
- pjmlp 6y agoHow industrial do you consider Android? https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/cmds/statsd/src/external/StatsPullerManager.cpp https://android.googlesource.com/platform/frameworks/base/+/...
- darkmx0z 6y agodid you check the header of that cpp? they are storing it in a shared_ptr: shared_ptr = referenced counted pointer = RAII they should have used make_shared, but it is still safe
- pjmlp 6y agoWhich isn't exception safe, as any good C++ developer would know.
- msla 6y ago"Google Does Bad Thing" is not quite equivalent to "C++ Is Bad Language"
- pjmlp 6y agoIndeed, it is even one of my favourite languages, but contradicts the OP's point of every industry C++ codebase has banned new and delete.
- int_19h 6y agoThe Google C++ style guide alone is sufficient evidence to conclude that Google doesn't know how to do C++ properly.
- ncmncm 6y agoIn a word, not.
- todd8 6y agoI don’t have first hand experience in the world of game programming, but I’ve heard that smart pointers aren’t used and old fashioned new and delete are standard practice. (Please correct me if I’m wrong, I’m curious if what I’ve heard about game development is really true.)