[patch] VOIDP2INT, INT2VOIDP and pointer size
Now (long) is used for converting (void *) to integer. This patch replaces (long) with intptr_t. I don't think this fixes the real problem. When VOIDP2INT and INT2VOIDP macros are used, it is possible that converted type won't fit into intptr_t. It is better to rewrite code that uses these macros in portable way and remove these macros. Anyway, using intptr_t is better than using (long), (long long) or introducing more autoconf dependency.
On Tue, Jun 12, 2012 at 11:25:33PM +0400, 123 wrote:
Now (long) is used for converting (void *) to integer. This patch replaces (long) with intptr_t.
I don't think this fixes the real problem. When VOIDP2INT and INT2VOIDP macros are used, it is possible that converted type won't fit into intptr_t. It is better to rewrite code that uses these macros in portable way and remove these macros.
Agreed, so let's go for the real fix - step by step. Even better would be if we could come up with a case where the current scheme causes a real problem - not sure if this is possible, some compiler warnings maybe? Cheers, Johannes
On Tue, Jun 12, 2012 at 10:46:38PM +0200, Johannes Hofmann wrote:
On Tue, Jun 12, 2012 at 11:25:33PM +0400, 123 wrote:
Now (long) is used for converting (void *) to integer. This patch replaces (long) with intptr_t.
I don't think this fixes the real problem. When VOIDP2INT and INT2VOIDP macros are used, it is possible that converted type won't fit into intptr_t. It is better to rewrite code that uses these macros in portable way and remove these macros.
Agreed, so let's go for the real fix - step by step. Even better would be if we could come up with a case where the current scheme causes a real problem - not sure if this is possible, some compiler warnings maybe?
There's an old adage: if it ain't broken don't fix it. I'd much prefer if you could focus your patches on real bugs instead of cleanups or changes to code form. -- Cheers Jorge.-
On Wed, Jun 13, 2012 at 12:38:33PM -0400, Jorge Arellano Cid wrote:
On Tue, Jun 12, 2012 at 10:46:38PM +0200, Johannes Hofmann wrote:
On Tue, Jun 12, 2012 at 11:25:33PM +0400, 123 wrote:
Now (long) is used for converting (void *) to integer. This patch replaces (long) with intptr_t.
I don't think this fixes the real problem. When VOIDP2INT and INT2VOIDP macros are used, it is possible that converted type won't fit into intptr_t. It is better to rewrite code that uses these macros in portable way and remove these macros.
Agreed, so let's go for the real fix - step by step. Even better would be if we could come up with a case where the current scheme causes a real problem - not sure if this is possible, some compiler warnings maybe?
There's an old adage: if it ain't broken don't fix it.
I'd much prefer if you could focus your patches on real bugs instead of cleanups or changes to code form.
Microsoft uses IL32LLP64 as memory model for Win64. So it certainly "ain't broken". Joerg
participants (4)
-
jcid@dillo.org
-
joerg.sonnenberger@web.de
-
Johannes.Hofmann@gmx.de
-
p37sitdu@lavabit.com