emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pdumper on Solaris 10


From: Pip Cet
Subject: Re: pdumper on Solaris 10
Date: Tue, 17 Dec 2024 19:43:02 +0000

"Paul Eggert" <eggert@cs.ucla.edu> writes:

> On 2024-12-15 03:13, Eli Zaretskii wrote:
>>> Date: Sun, 15 Dec 2024 10:55:49 +0000
>>> From: Pip Cet<pipcet@protonmail.com>
>>>
>>> "Eli Zaretskii"<eliz@gnu.org> writes:
>>>
>>>>      CC       igc.o
>>>>    igc.c: In function 'weak_hash_table_entry':
>>>>    igc.c:4102:16: warning: cast to pointer from integer of different size 
>>>> [-Wint-to-pointer-cast]
>>>>     4102 |       client = (mps_addr_t)entry.intptr;
>>>>    |                ^
>>>>    igc.c:4107:16: warning: cast to pointer from integer of different size 
>>>> [-Wint-to-pointer-cast]
>>>>     4107 |       client = (mps_addr_t)real_ptr;
>>>>    |                ^
> ...
>>> What's the preferred way of avoiding a compiler warning in this case?
>>> A simple double cast (first to uintptr_t, then to mps_addr_t) should
>>> work, right?
>> I'll defer to Paul (CC'ed), but my personal preference is also to
>> explicitly reset the ignored bits by bitwise AND.
>
> The usual way I avoid such warnings is a single cast of the pointer to
> uintptr_t (or to intptr_t, if the eventual destination is signed).

> There is no need for two casts, or for a bitwise AND, and I usually

In this case, the eventual destination is a pointer, so I don't see how
a single cast would work.  Changing mps_addr_t to be an integer seems a
bit drastic.

(The change I'm currently using does use an intermediate uintptr_t
variable, but it's still two casts).

Pip




reply via email to

[Prev in Thread] Current Thread [Next in Thread]