@@ -592,8 +592,14 @@ .SH BUGS
All catenation functions share the same performance problem:
.UR https://www.joelonsoftware.com/\:2001/12/11/\:back\-to\-basics/
Shlemiel the painter
.UE .
+As a mitigation,
+compilers are able to transform some calls to catenation functions
+into normal copy functions,
+since
+.I strlen(dst)
+is usually a byproduct of the previous copy.
.\" ----- EXAMPLES :: -------------------------------------------------/
.SH EXAMPLES
The following are examples of correct use of each of these functions.
.\" ----- EXAMPLES :: stpcpy(3) ---------------------------------------/
The compiler will sometimes optimize them to normal *cpy(3) functions, since the length of dst is usually known, if the previous *cpy(3) is visible to the compiler. And they provide for cleaner code. If you know that they'll get optimized, you could use them. Cc: Paul Eggert <eggert@cs.ucla.edu> Cc: Jonny Grant <jg@jguk.org> Cc: DJ Delorie <dj@redhat.com> Cc: Matthew House <mattlloydhouse@gmail.com> Cc: Oskari Pirhonen <xxc3ncoredxx@gmail.com> Cc: Thorsten Kukuk <kukuk@suse.com> Cc: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org> Cc: Zack Weinberg <zack@owlfolio.org> Cc: "G. Branden Robinson" <g.branden.robinson@gmail.com> Cc: Carlos O'Donell <carlos@redhat.com> Cc: Xi Ruoyao <xry111@xry111.site> Cc: Stefan Puiu <stefan.puiu@gmail.com> Cc: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Alejandro Colomar <alx@kernel.org> --- man7/string_copying.7 | 6 ++++++ 1 file changed, 6 insertions(+)