3 ms·
Somehow I don't find this to be a problem in my code. Yes, when using someone else's library you need to know how they handle ownership. But this is basically a
by marshray 13y ago
Somehow I don't find this to be a problem in my code. Yes, when using someone else's library you need to know how they handle ownership. But this is basically a problem inherited from C.
For example, in the code you posted all the pointer-like handles are named 'p'. In my experience, if we consistently pursue minimal scope and minimal lifetime for our objects, then longer-lived objects are oddballs and we use the type of the handle to help describe its ownership strategy.
- fauigerzigerk 13y agoI agree that this is an issue with third party libraries, not with my own code. But C++ libraries can be a real horror. Every single one of them comes with its own peculiar memory management idea. Recently I started to use rapidjson. It's insanely fast but that's not the only insanity. It basically screams for memory management bugs.
- pjmlp 13y agoEver done any enterprise C development? This is a very big problem in enterprise size code basis, specially with the rotation of external developers.
- marshray 13y agoOh noes. Yeah, C seems very not the thing to rotate external developers around in an enterprise size code base.