- Ensure that the output is always NUL-terminated. - Always include the terminating NUL in the returned length. - Allow out == NULL, allowing the caller to check how much space is required before allocating. - Add man page.