Re: integer types

2023-04-05 Thread Andreas Schwab
On Apr 05 2023, Eli Zaretskii wrote: > If the pointer is to a narrower type, then dereferencing it will take > only part of the bits of the integer value. Depending on the > endianness, that part could be the LSB (good) or MSB (bad). A conversion operates on the value, not representation, so end

Re: integer types

2023-04-05 Thread Gavin Smith
On Wed, Apr 05, 2023 at 05:14:03PM +0300, Eli Zaretskii wrote: > > From: Gavin Smith > > Date: Wed, 5 Apr 2023 14:59:23 +0100 > > Cc: pertu...@free.fr, ar...@gnu.org, bug-texinfo@gnu.org > > > > Might it be better to round-trip through intptr_t rather than through > > a pointer type? > > Yes, I

Re: integer types

2023-04-05 Thread Eli Zaretskii
> From: Gavin Smith > Date: Wed, 5 Apr 2023 14:59:23 +0100 > Cc: pertu...@free.fr, ar...@gnu.org, bug-texinfo@gnu.org > > Might it be better to round-trip through intptr_t rather than through > a pointer type? Yes, I think this will be better. Cleaner, too. > > I think you are forgetting the e

Re: integer types

2023-04-05 Thread Gavin Smith
ny valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer: intptr_t (From here, page 291: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1548.pdf) (We could end up with new warnings about

Re: integer types

2023-04-05 Thread Eli Zaretskii
> From: Gavin Smith > Date: Wed, 5 Apr 2023 12:24:58 +0100 > Cc: Patrice Dumas , ar...@gnu.org, bug-texinfo@gnu.org > > GNU coding standards (Info node (standards)CPU Portability): > > You need not cater to the possibility that 'long' will be smaller > than pointers and 'size_t'. We know

integer types

2023-04-05 Thread Gavin Smith
On Wed, Apr 05, 2023 at 01:08:41PM +0300, Eli Zaretskii wrote: > > Date: Wed, 5 Apr 2023 11:31:12 +0200 > > From: Patrice Dumas > > Cc: Arash Esbati , bug-texinfo@gnu.org > > > > On Wed, Apr 05, 2023 at 11:47:08AM +0300, Eli Zaretskii wrote: > > > Those are real bugs: we should cast to inptr_t in