2 ms·
Pointers passed in and out have a very important property that's critical for writing secure reliable programs but is not encoded anywhere in the language, and
by pjc50 5y ago
Pointers passed in and out have a very important property that's critical for writing secure reliable programs but is not encoded anywhere in the language, and that is lifetime and ownership.
If you pass a pointer to a function, will it free() it? Or store it somewhere where it will later free it? Can you now free it yourself safely or not?
Same applies to returned pointer values: don't free or must free?