On Mar 29, 2011, at 6:03 PM, Mathieu Desnoyers wrote:

* Mathieu Desnoyers ([email protected]) wrote:
* Nils Carlson ([email protected]) wrote:
[...]
Please document that the caller must free the char * returned.

+char *ustcomm_user_sock_dir(void)
+{

Actually, thinking about it a little more, we should probably even use a
naming convention that tells us we need to free memory returned by the
function return value pointer everywhere so that we can audit the caller
code easily for missing "free()".

e.g., in this case:

char *ustcomm_alloc_user_sock_dir(void)

Thoughts ?


Well, I agree that this can be a good principle, especially for structs, but I think that for (char *) this is overkill. If something returns a (char *) you expect it
to allocate memory, unless it explicitly states that it doesn't.

But documenting is good.

/Nils



Thanks,

Mathieu

--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com

_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev


_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to