Re: [PATCH 1/4] mempool: use wide enough type for pointer arithmetic

Simon Richter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
Hi,

On 10.02.2016 22:10, Lawrence D'Oliveiro wrote:

>> The "unsigned long" type on Windows is just 32 bits wide, so
>> converting from and to a pointer is unsafe.

> “unsigned long long” should work.

Yes, but that is 64 bits wide even on 32 bit architectures.

>> Replace this with intptr_t, which is guaranteed to be wide enough. It
>> would be better to use uintptr_t here, but this is not available in
>> several MSVC versions.

> What about size_t?

That doesn't come with a guarantee either.

The cleanest solution IMO would be to introduce a few "#ifdef"s, and
just add "typedef UINTPTR_T uintptr_t;" on MSVC (MSYS has a definition
for uintptr_t), but doing that in a way that doesn't break anything else
will be more involved.

   Simon

-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
signature.asc (application/pgp-signature, 473 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJWu6ubAAoJEH69OHuwmQgRI/YH/3nkLhm2YDeN7xHLMhfRKm4Z
7j38zjgmnU3XG3hF6D7ziQkr6tBXMrjQQOVjVqffSlp+1qghfwdoIr8zJF7EwQCb
0EK4CNE56zdpXMgnGBXYSjh4qIoAjGk56coDs7pgW5L82n6AAFaoDCIalVpBP4pc
dkZuL51+aV0vou+q5itNK1WxClRPgKICbQbK6k7KfISeCTbr2cq44Tt/72bvUD+d
OiwO7ZBT2mRsVrwAGnaW3jbymtGOAU3ZXNisw4uRYBYWtk+yK8UlFl1bytpW9iDt
kJjRuEJJVTam/Luyr4GxcCMVynFTmpdd1SzreCQvknwoEGY6pFISwOiuHgW+pO0=
=JA4r
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.