All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Alejandro Colomar <alx.manpages@gmail.com>
Cc: g.branden.robinson@gmail.com, linux-man@vger.kernel.org,
	groff@gnu.org, Ralph Corderoy <ralph@inputplus.co.uk>
Subject: Re: [PATCH v4] NULL.3const: Add documentation for NULL
Date: Wed, 27 Jul 2022 11:50:24 +0200	[thread overview]
Message-ID: <YuEKYAhun0SKZAmw@asta-kit.de> (raw)
In-Reply-To: <b3d990c2-c1be-3202-930d-f8c44be2a5e2@gmail.com>

Hi,

Alejandro Colomar wrote on Tue, Jul 26, 2022 at 08:47:59PM +0200:
> On 7/26/22 17:54, G. Branden Robinson wrote:
>> Alejandro Colomar wrote:

>>> +.SH NOTES
>>> +The following headers also provide
>>> +.BR NULL :
>>> +.IR <locale.h> ,
>>> +.IR <stdio.h> ,
>>> +.IR <stdlib.h> ,
>>> +.IR <string.h> ,
>>> +.IR <time.h> ,
>>> +.IR <unistd.h> ,
>>> +and
>>> +.IR <wchar.h> .

>> Not exactly on topic (sorry), but apropos of our concurrent discussion
>> on man pages for constants with external linkage and data types, the
>> foregoing is an excellent counterexample of what I contend is good
>> practice: document them in the man page for the header file.

> For countering that, I'd point you to tm(3type).
> If I document in such detail every type and constant in <time.h>, the 
> page will become an unreadable mess, IMO.
> 
> NULL(3const) is also a good example.  stddef(0posix) has 2 lines + a 
> blank for NULL.
> 
> Now consider a page that documents NULL, offsetof(), ptrdiff_t, size_t 
> (all of them already documented, so you can take a look at their pages 
> to get an idea of their docs), + wchar_t (yet undocumented).
> 
> stddef.h(0posix) is very short about them, and IMO, it's quite 
> incomplete.  But I could live with it if I had link pages to it (it 
> would be suboptimal to my needs, but I could certainly live with it).

For once, i agree.  Manual pages for header files (like stddef.h(3))
are an even worse idea than manual pages for preprocessor constants
and data types.  The main reason is that almost every header file
includes so much material that such pages would become unreasonably
large, just as Alejandro explains above.  Besides, the material in
a typical header file is not so closely related among itself that
it should share a manual page.  And in fact, documentation for
almost every header file is already split up into many manual
pages: one for each group of closely related functions.

[...]
>> POSIX supplements to the standard C library, and other libraries for C,
>> will not typically have this difficulty, and will have one definition
>> site only for their constants with external linkage.

> Oh, no.  Check ssize_t(3type)!

Indeed.

Then again, while NULL and size_t are exceptional in so far as they
are so widely used that there is no clear place for documenting them,
most types are better documented together with the most typical
function using them.

For example, document  struct tm  in  localtime(3)  and
                       ssize_t    in  read(2).

Besides, almost nothing needs to be said where ssize_t is documented.
In particular, documentation of %zd belongs with printf(3), not with
ssize_t(3type).

Yours,
  Ingo

      reply	other threads:[~2022-07-27  9:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 15:31 [PATCH] NULL.3def: Add documentation for NULL Alejandro Colomar
2022-07-23 10:23 ` Ralph Corderoy
2022-07-24 12:49   ` Alejandro Colomar (man-pages)
2022-07-24 18:36 ` [PATCH] NULL.3const: " Alejandro Colomar
2022-07-24 19:19 ` [PATCH v3] " Alejandro Colomar
2022-07-25 18:49   ` Ingo Schwarze
2022-07-26 12:02     ` Alejandro Colomar
2022-07-27 10:49       ` Ingo Schwarze
2022-07-27 13:11         ` Alejandro Colomar
2022-07-28 23:28           ` Alejandro Colomar
2022-07-25 18:57   ` Jakub Wilk
2022-07-26 12:36     ` Alejandro Colomar
2022-07-26 12:48   ` [PATCH v4] " Alejandro Colomar
2022-07-26 15:54     ` G. Branden Robinson
2022-07-26 18:47       ` Alejandro Colomar
2022-07-27  9:50         ` Ingo Schwarze [this message]

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=YuEKYAhun0SKZAmw@asta-kit.de \
    --to=schwarze@usta.de \
    --cc=alx.manpages@gmail.com \
    --cc=g.branden.robinson@gmail.com \
    --cc=groff@gnu.org \
    --cc=linux-man@vger.kernel.org \
    --cc=ralph@inputplus.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.