From: Paul Eggert <eggert@cs.ucla.edu>
To: Joseph Myers <joseph@codesourcery.com>
Cc: Florian Weimer <fweimer@redhat.com>,
libc-alpha@sourceware.org, JeanHeyd Meneide <wg14@soasis.org>,
Alex Colomar <alx.manpages@gmail.com>
Subject: Re: [PATCH] inttypes.h: imaxabs(3): Implement as a macro
Date: Tue, 13 Sep 2022 13:47:00 -0500 [thread overview]
Message-ID: <bf465340-41e2-32c3-ba18-8ddb63b468a7@cs.ucla.edu> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2209131820570.3083096@digraph.polyomino.org.uk>
On 9/13/22 13:27, Joseph Myers wrote:
> C2x allows integer types wider than intmax_t in certain cases....
> (Changing intmax_t would be a pain because of the very large
> number of printf-like functions in glibc, all of whose ABIs involve
> intmax_t.)
It would indeed be a pain. However, the possibility of
wider-than-intmax_t types is potentially even a much greater pain for
user code. It's common, for example, for user code to have functions
like this:
int
print_offset (off_t offset)
{
intmax_t off = offset;
return printf ("%jd", off);
}
Unfortunately, code like this would not work if off_t were wider than
intmax_t. This is fresh in my mind as I recently added code like the
above to paxutils, replacing older, pre-C99 code that converted off_t to
strings by hand. Was I mistaken?
<https://git.savannah.gnu.org/cgit/paxutils.git/commit/?id=2bf63fcba72c4f4bc54a4caf53d7923c1f9f174f>
Is it safe to assume that standard types like off_t are no wider than
intmax_t? If so, this should be documented explicitly somewhere in the
glibc manual. If not, user code would be in so much hurt that it really
ought to be glibc's job to widen intmax_t to be at least as wide as
standard types, as painful as that widening might be.
next prev parent reply other threads:[~2022-09-13 18:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 15:18 Alex Colomar
2022-09-13 15:28 ` Alejandro Colomar
2022-09-13 15:34 ` Alejandro Colomar
2022-09-13 18:27 ` Joseph Myers
2022-09-13 18:47 ` Paul Eggert [this message]
2022-09-13 19:30 ` Joseph Myers
2022-09-13 20:59 ` Paul Eggert
2022-09-13 22:43 ` Alejandro Colomar
2022-09-13 22:56 ` Joseph Myers
2022-09-13 23:43 ` Alejandro Colomar
2022-09-14 16:41 ` Joseph Myers
2022-09-14 19:03 ` JeanHeyd Meneide
2022-09-15 12:33 ` Alejandro (Alex) 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=bf465340-41e2-32c3-ba18-8ddb63b468a7@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=alx.manpages@gmail.com \
--cc=fweimer@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=wg14@soasis.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).