public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx@kernel.org>
To: Rene Kita <mail@rkta.de>
Cc: linux-man@vger.kernel.org
Subject: Re: QChar and QVoid for strchr(3), memchr(3), et al.
Date: Tue, 24 Feb 2026 22:41:58 +0100	[thread overview]
Message-ID: <aZ4Y_-MagoDmdE9g@devuan> (raw)
In-Reply-To: <20260224185233.GE43043@x220.rkta.de>

[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]

Hi Rene,

On 2026-02-24T19:52:33+0100, Rene Kita wrote:
> > -  In the SYNOPSIS, do you prefer QChar/QVoid or overload style?
> > 
> > 	QChar *strchr(QChar *s, int c);
> >    vs
> > 	char *strnul(char *s);
> > 	const char *strnul(const char *s);
> 
> IMHO the overload style is more appropriate for the next few years.
> Everyone who has at least read K&R C will understand it.

Ok.

> For technical correctness the QChar/QVoid style should be mentioned, though.
> That's why...
> 
> > -  If we document it as QChar/QVoid, I guess we should we add a
> >    QChar(3)/QVoid(3) manual page documenting all of the details, to
> >    avoid duplicating such details in each manual page.
> 
> these man pages should be created in either case.
> 
> > -  How much should we document the old function?  Should we keep that as
> >    a historic detail in the QChar(3)/QVoid(3) page?
> 
> As I usually don't deal with C23 - and don't expect this to change for a
> few years - I would prefer to have the old function documented. It might
> be that I work on a C99 project while viewing the latest man pages on a
> Arch system.

A problem, even if you write C99 on your project (let's say mutt(1), for
example), is that the compiler will default to something newer, and
you'll be exposed to those APIs.  If they're not documented, you'll be
quite surprised that your code suddenly fails.  So I think they should
be documented.  Of course, the old function would also need to be
documented, because otherwise people might be surprised the other way
around.

Hmmm, how about something like this?

	SYNOPSIS
		#include <string.h>

		char *strchr(char *s, int c);
		const char *strchr(const char *s, int c);

		#undef strchr
		char *strchr(const char *s, int c);

Plus a paragraph in HISTORY clarifying this.


Have a lovely night!
Alex

-- 
<https://www.alejandro-colomar.es>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-02-24 21:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24 14:28 QChar and QVoid for strchr(3), memchr(3), et al Alejandro Colomar
2026-02-24 16:56 ` Mark Harris
2026-02-24 17:14 ` Paul Eggert
2026-02-24 21:31   ` Alejandro Colomar
2026-02-24 23:04     ` Paul Eggert
2026-02-24 23:05       ` Alejandro Colomar
2026-02-24 23:19         ` Paul Eggert
2026-02-24 23:34           ` Alejandro Colomar
2026-02-25  1:03             ` Mark Harris
2026-02-25  1:15               ` Alejandro Colomar
2026-02-24 18:52 ` Rene Kita
2026-02-24 21:41   ` Alejandro Colomar [this message]
2026-02-25 15:48     ` Rene Kita

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZ4Y_-MagoDmdE9g@devuan \
    --to=alx@kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mail@rkta.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox