emacs-devel
[Top][All Lists]
Advanced

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

Re: pdumper on Solaris 10


From: Eli Zaretskii
Subject: Re: pdumper on Solaris 10
Date: Tue, 17 Dec 2024 22:19:14 +0200

> Date: Tue, 17 Dec 2024 11:10:45 -0800
> Cc: gerd.moellmann@gmail.com, emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> 
> >>>      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).

But then why doesn't the cast to mps_addr_t work to avoid the warning?
mps_addr_t is 'void *', a 32-bit pointer.  Is this something specific
to pointers, while casting to a 32-bit integer doesn't trigger the
warnings?  If so, what is the rationale for warning about pointers,
but not about integers?



reply via email to

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