All of lore.kernel.org
 help / color / mirror / Atom feed
* wcschr(3): add special case for  NUL, as in strchr(3)
@ 2021-07-12  9:37 Stefan Kanthak
  2021-07-12 16:09 ` Jakub Wilk
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kanthak @ 2021-07-12  9:37 UTC (permalink / raw)
  To: mtk.manpages, alx.manpages; +Cc: linux-man

Hi,

in the section return value, strchr(3) and strrchr(3) explicitly
state the behaviour for NUL:

<https://man7.org/linux/man-pages/man3/strstr.3.html#RETURN_VALUE>
<https://man7.org/linux/man-pages/man3/strrchr.3.html#RETURN_VALUE>

|  The terminating null byte is considered part of the string, so
|  that if c is specified as '\0', these functions return a pointer
|  to the terminator.

JFTR: to avoid any possible confusion of "null byte" alias NUL with
      the "null pointer" alias NULL (C macro) or nullptr (C++),
      "null byte" should be replaced with "NUL byte"!

The same explicit statement is but missing from both
<https://man7.org/linux/man-pages/man3/wcschr.3.html#RETURN_VALUE>
and
<https://man7.org/linux/man-pages/man3/wcsrchr.3.html#RETURN_VALUE>
and should be added there.

regards
Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wcschr(3): add special case for  NUL, as in strchr(3)
  2021-07-12  9:37 wcschr(3): add special case for NUL, as in strchr(3) Stefan Kanthak
@ 2021-07-12 16:09 ` Jakub Wilk
  2021-07-12 18:41   ` Stefan Kanthak
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Wilk @ 2021-07-12 16:09 UTC (permalink / raw)
  To: Stefan Kanthak; +Cc: mtk.manpages, alx.manpages, linux-man

* Stefan Kanthak <stefan.kanthak@nexgo.de>, 2021-07-12, 11:37:
>JFTR: to avoid any possible confusion of "null byte" alias NUL with the 
>"null pointer" alias NULL (C macro) or nullptr (C++), "null byte" 
>should be replaced with "NUL byte"!

"NUL byte" looks like a typo for "NULL byte", so if anything, it makes 
the potential for confusion greater.

Anyway, "null byte" is the preferred term in the man-pages style guide; 
see the "NULL, NUL, null pointer, and null character" subsection in 
man-pages(7).

-- 
Jakub Wilk

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wcschr(3): add special case for  NUL, as in strchr(3)
  2021-07-12 16:09 ` Jakub Wilk
@ 2021-07-12 18:41   ` Stefan Kanthak
  2021-08-10  6:40     ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kanthak @ 2021-07-12 18:41 UTC (permalink / raw)
  To: Jakub Wilk; +Cc: mtk.manpages, alx.manpages, linux-man

"Jakub Wilk" wrote:

>* Stefan Kanthak <stefan.kanthak@nexgo.de>, 2021-07-12, 11:37:
>>JFTR: to avoid any possible confusion of "null byte" alias NUL with the 
>>"null pointer" alias NULL (C macro) or nullptr (C++), "null byte" 
>>should be replaced with "NUL byte"!
> 
> "NUL byte" looks like a typo for "NULL byte", so if anything, it makes 
> the potential for confusion greater.
> 
> Anyway, "null byte" is the preferred term in the man-pages style guide; 
> see the "NULL, NUL, null pointer, and null character" subsection in 
> man-pages(7).

Despite the statement

| Avoid also the terms "zero byte" and "null character".

the heading of said subsection itself but says "null character" instead
of the preferred "null byte"!

JFTR: the search function on <https://man7.org/linux/man-pages/index.html>
      gives 21 matches for "zero byte", 46 matches for "null character",
      and 146 matches for "null byte", i.e. the preferred term is not used
      in 1 of 3 cases.

And despite the statement

| The preferred term for the pointer is "null pointer" or simply
| "NULL"; avoid writing "NULL pointer".

plus a changelog entry (for version 3.56)

| Various pages
|    Michael Kerrisk
|        Global fix of "NULL pointer"
|            Change "NULL pointer" to "NULL" or null pointer".
|            POSIX uses the term "null pointer", not "NULL pointer".

43 pages still contain "NULL pointer", while 197 pages say "null pointer".

There's plenty room for improvement!

Stefan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wcschr(3): add special case for NUL, as in strchr(3)
  2021-07-12 18:41   ` Stefan Kanthak
@ 2021-08-10  6:40     ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-08-10  6:40 UTC (permalink / raw)
  To: Stefan Kanthak; +Cc: Jakub Wilk, Alejandro Colomar (man-pages), linux-man

On Mon, 12 Jul 2021 at 20:44, Stefan Kanthak <stefan.kanthak@nexgo.de> wrote:
>
> "Jakub Wilk" wrote:
>
> >* Stefan Kanthak <stefan.kanthak@nexgo.de>, 2021-07-12, 11:37:
> >>JFTR: to avoid any possible confusion of "null byte" alias NUL with the
> >>"null pointer" alias NULL (C macro) or nullptr (C++), "null byte"
> >>should be replaced with "NUL byte"!
> >
> > "NUL byte" looks like a typo for "NULL byte", so if anything, it makes
> > the potential for confusion greater.

Exactly my concern.

> > Anyway, "null byte" is the preferred term in the man-pages style guide;
> > see the "NULL, NUL, null pointer, and null character" subsection in
> > man-pages(7).

Also, "null byte" is the term used in the C standard.

> Despite the statement
>
> | Avoid also the terms "zero byte" and "null character".
>
> the heading of said subsection itself but says "null character" instead
> of the preferred "null byte"!

That's fixed now.

> JFTR: the search function on <https://man7.org/linux/man-pages/index.html>
>       gives 21 matches for "zero byte", 46 matches for "null character",

Sure, but that presumably is because of pages in other projects.
(man7.org renders pages from 100+ projects.)

>       and 146 matches for "null byte", i.e. the preferred term is not used
>       in 1 of 3 cases.
>
> And despite the statement
>
> | The preferred term for the pointer is "null pointer" or simply
> | "NULL"; avoid writing "NULL pointer".
>
> plus a changelog entry (for version 3.56)
>
> | Various pages
> |    Michael Kerrisk
> |        Global fix of "NULL pointer"
> |            Change "NULL pointer" to "NULL" or null pointer".
> |            POSIX uses the term "null pointer", not "NULL pointer".
>
> 43 pages still contain "NULL pointer", while 197 pages say "null pointer".
>
> There's plenty room for improvement!

I agree, but I think the issue is mostly fixed in man-pages.

Thanks,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-10  6:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12  9:37 wcschr(3): add special case for NUL, as in strchr(3) Stefan Kanthak
2021-07-12 16:09 ` Jakub Wilk
2021-07-12 18:41   ` Stefan Kanthak
2021-08-10  6:40     ` Michael Kerrisk (man-pages)

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.