potentially incorrect conversion of pointer to unsigned long

Kevin J. McCarthy kevin at 8t8.us
Sat Jun 22 14:19:41 UTC 2019


On Sat, Jun 22, 2019 at 09:42:36AM +0200, Vincent Lefevre wrote:
>Thus one has conversions of a pointer (char *) to unsigned long. This 
>is implementation-defined and can even be undefined behavior if "the 
>result cannot be represented in the integer type", in particular if 
>unsigned long is smaller than pointers (e.g. with the LLP64 data model, 
>like under MS Windows64).

Thanks, Vincent.  It always seemed a bit dubious to me, but since it has 
been that way for 25 years, I figured "let it be".  :-)

>IMHO, the best solution for safety would be to use a union (I think 
>that this would require the use of C99 designators for the MuttVars 
>initialization).

Okay, I will work on this.  I think it's better to fix this the right 
way now then get bitten by this later.

-- 
Kevin J. McCarthy
GPG Fingerprint: 8975 A9B3 3AA3 7910 385C  5308 ADEF 7684 8031 6BDA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-dev/attachments/20190622/8a45ffe6/attachment.asc>


More information about the Mutt-dev mailing list