Re: [PATCH v3 1/2] man/man3/strto[u]l.3: BUGS: Signed numbers and white space are not rejected

Alejandro Colomar
2025-03-23T11:16:00Z

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

Hi Bruno,

On Sun, Mar 23, 2025 at 11:27:53AM +0100, Bruno Haible wrote:
> Thanks for theses BUGS sections, Alejandro.
>
> > +.SS White space
> > +These functions silently accept leading white space.
> > +One should call
> > +.BR isspace (3)
> > +before
> > +.BR strtol ()
> > +to reject white space.
>
> Just a question of wording, but it would be more straightforward to read
> when written like this:
>
> +.SS White space
> +These functions silently accept leading white space.
> +In situations where rejecting white space is desired instead, call
> +.BR isspace (3)
> +before
> +.BR strtol ().
>
> (As usual, presenting the "why" and "what" before the "how" is nicer. [1])

LGTM. I'd make it shorter, though. How about this?

+.SS White space
+These functions silently accept leading white space.
+To reject white space, call
+.BR isspace (3)
+before
+.BR strtol ().

which BTW makes it more consistent with your proposal from below.

>
> > +One should call
> > +.BR isalnum (3)
> > +before
> > +.BR strtoul ()
> > +to reject white space and/or a sign.
>
> Likewise here. It is more straightforward when written like this:
>
> +To reject white space and/or a sign, call
> +.BR isalnum (3)
> +before
> +.BR strtoul ().
>
> Bruno
>
> [1] https://gitlab.com/ghwiki/gnow-how/-/wikis/Documentation/Writing

Thanks! That's useful. :)

Have a lovely day!
Alex

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