[cairo] [PATCH 1/4] mempool: use wide enough type for pointer arithmetic
Simon Richter
Simon.Richter at hogyros.de
Wed Feb 10 21:28:59 UTC 2016
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.cairographics.org/archives/cairo/attachments/20160210/73f04010/attachment.sig>
More information about the cairo
mailing list