3 ms·
Substructure objects contain other objects contain other objects and so on. Are you going to grep for all of these? Yes, in this situation owned Expr pointers
by Manishearth 12y ago
Substructure objects contain other objects contain other objects and so on. Are you going to grep for all of these?
Yes, in this situation owned Expr pointers are returned, and fortunately I know that Expr contained no borrowed data (with a lack of lifetime annotation that is easy, but in C++ you might have to check)
But there could be other pointers being passed around internally (eg replacing the old pointer from a field of an argument with a new one, one which actually is short lived or is being iterated over. Just because a pointer isn't returned doesn't mean we're safe. With const we get some safety until interior mutability and casts come into the picture -- as I said before, consting a complex codebase is not easy unless you keep switching back and forth.