Re: stpecpy(): A better string copy function (was: memccpy(3) and stpcpy(3) status in C2x)

2022-02-14 Thread Alejandro Colomar (man-pages)
On 2/14/22 21:34, Steffen Nurpmeso wrote: > I personally like my > > /*! Copy \a{src} to \a{dst}, return pointer to NUL in \a{dst}. >* Returns \NIL if \a{dst} is not large enough; \a{dst} will always be >* terminated unless \a{n} was 0 on entry. */ > EXPORT char *su_cs_pcopy_n(char

Re: memccpy(3) and stpcpy(3) status in C2x (was: stpecpy(): A better string copy function)

2022-02-14 Thread Steffen Nurpmeso
Martin Sebor wrote in : |On 2/13/22 13:32, Alejandro Colomar (man-pages) wrote: |> On 2/13/22 19:29, Alejandro Colomar (man-pages) wrote: .. |>>> I expect/hope stpcpy to become the new norm for string copying, though |>>> it will require overcoming much inertia and many dusty old books. |>>>

Re: memccpy(3) and stpcpy(3) status in C2x (was: stpecpy(): A better string copy function)

2022-02-14 Thread Martin Sebor
On 2/13/22 13:32, Alejandro Colomar (man-pages) wrote: Hi Branden, On 2/13/22 19:29, Alejandro Colomar (man-pages) wrote: Oh, I was going to ask if you were aware of stpcpy(), but if I click the link to codidact I see that you are. I expect/hope stpcpy to become the new norm for string copying

Re: stpecpy(): A better string copy function

2022-02-13 Thread Larry McVoy
On Sun, Feb 13, 2022 at 09:28:02PM -0500, Douglas McIlroy wrote: > (As a matter of programming style, I prefer to use 0 to specify a null > pointer; it doesn't require one to haul in stddef.h as NULL does. And > it doesn't shout.) Amen.

Re: stpecpy(): A better string copy function

2022-02-13 Thread Douglas McIlroy
>>> if (!*dst) >> >> As I've noted elsewhere (can't remember if it's where you might have >> seen it), I dislike punning pointers to Booleans. But this is a matter >> of style, and as far as I know nothing can go wrong with it. > > I wasn't punning the pointer to bool (which I also do

memccpy(3) and stpcpy(3) status in C2x (was: stpecpy(): A better string copy function)

2022-02-13 Thread Alejandro Colomar (man-pages)
Hi Branden, On 2/13/22 19:29, Alejandro Colomar (man-pages) wrote: >> Oh, I was going to ask if you were aware of stpcpy(), but if I click the >> link to codidact I see that you are. >> >> I expect/hope stpcpy to become the new norm for string copying, though >> it will require overcoming much ine

Re: Fwd: Re: stpecpy(): A better string copy function

2022-02-13 Thread Alejandro Colomar (man-pages)
On 2/13/22 19:29, Alejandro Colomar (man-pages) wrote: > My opinion about that paper is that K&R C was far from perfect, and ISO > C is much more close to perfection than K&R C ever was (but I was s/I/it/ :/ > already good enough to base ISO C on it).

Re: Fwd: Re: stpecpy(): A better string copy function

2022-02-13 Thread Alejandro Colomar (man-pages)
Hi, Branden and Martin! On 2/13/22 01:40, G. Branden Robinson wrote: > At 2022-02-13T01:05:13+0100, Alejandro Colomar (man-pages) wrote: >> I designed some string copying function that attempts to improve >> strecopy(), and of course the common/standard ones, including >> strlcpy(3BSD) and strsc

Fwd: Re: stpecpy(): A better string copy function

2022-02-13 Thread Alejandro Colomar (man-pages)
Forwarded Message Subject: Re: stpecpy(): A better string copy function (was: CHECKSTYLE: Report consecutive .?P (paragraph macros)) Date: Sun, 13 Feb 2022 11:40:04 +1100 From: G. Branden Robinson To: Alejandro Colomar (man-pages) Hi, Alex! At 2022-02-13T01:05:13+0100

Fwd: stpecpy(): A better string copy function

2022-02-13 Thread Alejandro Colomar (man-pages)
u're CCd here in the following emails in this thread. Forwarded Message ---- Subject: stpecpy(): A better string copy function (was: CHECKSTYLE: Report consecutive .?P (paragraph macros)) Date: Sun, 13 Feb 2022 01:05:13 +0100 From: Alejandro Colomar (man-pages) To: G. Branden Robi