Re: freeing text

Damon Chaplin <damon ximian com> writes:

For the docs I wrote, if you had to free a returned value it said
like 'You should free the string when you no longer need it.'
And if you didn't have to free it it wasn't mentioned in the docs.

Do people think that is the correct way to document memory management?

Or should we also document all functions where you don't have to free
returned value? e.g. 'The returned string should not be freed.'

I suppose the advantage of that is that you know for sure one way or
the other. Currently the documentation person may just have forgot about
the issue.

I usually mention it either way, and also we have G_CONST_RETURN now
which will indicate whether you need to free, at least for return
values (though not for out params such as this one).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]