Copying and concatenating strings with str5 functions

Eric Sanchis eric.sanchis@iut-rodez.fr
Sat Nov 1 13:49:00 GMT 2014


Dear maintainers,

Today, string copy/concatenation remains a problem. I suggest an
alternative to strncpy/strncat (strn) and strlcpy/strlcat (strl)
functions.

Str5cpy/str5cat functions are:
- C89 compliant
- Safer and easier to use than strn/strl functions
- Transparent (no silent unwanted behaviour) and orthogonal (uniform behaviour).

They return a meaningful return value and produce auto-documented source code.

Please, take a look to the str5 functions and the companion document:

http://aral.iut-rodez.fr/en/sanchis/miscellaneous/str5/str5.html


Using strcpy/strcat in simple cases and str5cpy/str5cat in tricky
situations could be a good compromise.

Sincerely yours,

Eric Sanchis
University of Toulouse Capitole (IUT de Rodez)



More information about the Libc-help mailing list