How do you think about memory ownership and resource management on a fast-moving team, and when is a raw pointer still acceptable?
Last updated
Default to RAII (tie each resource to an object whose destructor releases it) and encode ownership in types:
std::unique_ptrfor single ownership,std::shared_ptronly when truly shared,std::weak_ptrto break cycles.Raw pointers are acceptable only as non-owning handles (observing parameters, optional rebindable references) whose pointee is guaranteed to outlive them. Never manage them with manual
new/delete.A clear team rule (owners hold smart pointers, APIs borrow via raw pointers or references) lets reviewers spot leaks and dangling pointers at a glance.