From: Bruno Haible <bruno@clisp.org>
To: Alejandro Colomar <alx@kernel.org>,
bug-gnulib@gnu.org, Michael Vetter <jubalh@iodoru.org>
Cc: "Paul Eggert" <eggert@cs.ucla.edu>,
"Đoàn Trần Công Danh" <congdanhqx@gmail.com>,
"Eli Schwartz" <eschwartz93@gmail.com>,
"Sam James" <sam@gentoo.org>, "Serge Hallyn" <serge@hallyn.com>,
"Iker Pedrosa" <ipedrosa@redhat.com>,
liba2i@lists.linux.dev
Subject: Re: [PATCH v1] xstrtol: Remove dead code
Date: Fri, 19 Jul 2024 00:34:39 +0200 [thread overview]
Message-ID: <1937032.gKo4GoxMFQ@nimes> (raw)
In-Reply-To: <kul6qwyrvq2xdevjjkkblsalg7ycwg6x7ey725kans5myqjcai@3jm56c5famlt>
Alejandro Colomar wrote:
> > - Some systems return "wrong" errno values. Example: [1]
> > - Some systems fail with ENOMEM when memory is tight. Who says that
> > an implementation of strtol() cannot use malloc() ? Some implementations
> > of strtod() do use malloc().
> >
> > So, what you call "dead code", I call "defensive programming". I would not
> > like to apply this patch.
>
> Makes sense. I think we should document that possibility in the manual
> page.
Well, I wouldn't want to document just _theoretical_ platforms. The set of
manual pages has a certain scope, regarding platform, probably Linux
(and Hurd, maybe?). It's the behaviour on these platforms which should
be documented, nothing more, nothing less.
Defensive programming means to imagine other behaviours that could
possibly occur. It is subjective; some programmers want to be more cautious
than others.
> Maybe say that other errno values are possible in some systems?
Other errno values are always possible, as far as I understand POSIX.
<https://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap01.html>
section 1.2 ERRORS.
It would be overkill to state this in hundreds of manual pages, IMO.
Bruno
next prev parent reply other threads:[~2024-07-18 22:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-18 20:33 [PATCH v1] xstrtol: Remove dead code Alejandro Colomar
2024-07-18 21:09 ` Bruno Haible
2024-07-18 21:25 ` Alejandro Colomar
2024-07-18 21:33 ` Andrew J. Hesford
2024-07-18 22:14 ` Alejandro Colomar
2024-07-18 23:32 ` Alejandro Colomar
2024-07-19 17:13 ` Bruno Haible
2024-07-18 22:34 ` Bruno Haible [this message]
2024-07-18 23:21 ` Alejandro Colomar
2024-07-19 16:54 ` Bruno Haible
2024-07-19 18:15 ` Alejandro Colomar
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=1937032.gKo4GoxMFQ@nimes \
--to=bruno@clisp.org \
--cc=alx@kernel.org \
--cc=bug-gnulib@gnu.org \
--cc=congdanhqx@gmail.com \
--cc=eggert@cs.ucla.edu \
--cc=eschwartz93@gmail.com \
--cc=ipedrosa@redhat.com \
--cc=jubalh@iodoru.org \
--cc=liba2i@lists.linux.dev \
--cc=sam@gentoo.org \
--cc=serge@hallyn.com \
/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