"By relying on memccpy optimizing compilers will be able to transform simple snprintf (d, dsize, "%s", s) calls into the optimally efficient calls to s)
memccpy (d, s, '\0', dsize).s, "
Idea was presented in "Toward more efficient string copying and concatenation": http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2349.htm
memccpy is part of C 20'\0', so in the future it will be more useful than now. (only posix has memccpy now)size - 1),
d[size - 1] = 0