Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-05 Thread Joerg Sonnenberger
On Thu, Feb 05, 2009 at 06:25:40PM +0100, Tomas Carnecky wrote: On 02/04/2009 09:04 PM, Joerg Sonnenberger wrote: On Wed, Feb 04, 2009 at 08:43:43PM +0100, Tomas Carnecky wrote: By first casting to long and then to the final type. Of course this assumes that sizeof(long) == sizeof(void *). If

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-05 Thread Paulo César Pereira de Andrade
Simon Thum wrote: Tomas Carnecky wrote: By first casting to long and then to the final type. Of course this assumes that sizeof(long) == sizeof(void *). If the Win32 Forgive my stupidity, but isn't it a C language rule that sizeof(long) == sizeof(void *) is always true? This of course may

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-05 Thread Julien Cristau
On Thu, 2009-02-05 at 16:16 -0200, Paulo César Pereira de Andrade wrote: Forgive my stupidity, but isn't it a C language rule that sizeof(long) == sizeof(void *) is always true? No. As said earlier in this thread there are IL32P64 systems. Cheers, Julien

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-05 Thread Tomas Carnecky
On 02/05/2009 07:16 PM, Paulo César Pereira de Andrade wrote: Simon Thum wrote: Tomas Carnecky wrote: By first casting to long and then to the final type. Of course this assumes that sizeof(long) == sizeof(void *). If the Win32 Forgive my stupidity, but isn't it a C language rule that

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-05 Thread Paulo César Pereira de Andrade
Julien Cristau wrote: On Thu, 2009-02-05 at 16:16 -0200, Paulo César Pereira de Andrade wrote: Forgive my stupidity, but isn't it a C language rule that sizeof(long) == sizeof(void *) is always true? No. As said earlier in this thread there are IL32P64 systems. Thanks, I will not reply

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-05 Thread Paulo César Pereira de Andrade
Corbin Simpson wrote: Forgive my stupidity, but isn't it a C language rule that sizeof(long) == sizeof(void *) is always true? No. As said earlier in this thread there are IL32P64 systems. C only makes one guarantee regarding sizeof() and primitives, and that is that sizeof(char) == 1.

[PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-04 Thread Tomas Carnecky
By first casting to long and then to the final type. Of course this assumes that sizeof(long) == sizeof(void *). If the Win32 folks care enough about warnings, we could make macros for this. Signed-off-by: Tomas Carnecky t...@dbservice.com --- Let's suppose macros would be preferred, into which

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-04 Thread Joerg Sonnenberger
On Wed, Feb 04, 2009 at 08:43:43PM +0100, Tomas Carnecky wrote: By first casting to long and then to the final type. Of course this assumes that sizeof(long) == sizeof(void *). If the Win32 folks care enough about warnings, we could make macros for this. Please use either uintptr_t (prefered)

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-04 Thread Ian Romanick
On Wed, Feb 04, 2009 at 09:04:05PM +0100, Joerg Sonnenberger wrote: On Wed, Feb 04, 2009 at 08:43:43PM +0100, Tomas Carnecky wrote: By first casting to long and then to the final type. Of course this assumes that sizeof(long) == sizeof(void *). If the Win32 folks care enough about warnings,

Re: [PATCH] Fix cast int-to-pointer and pointer-to-int

2009-02-04 Thread Joerg Sonnenberger
On Wed, Feb 04, 2009 at 02:10:36PM -0800, Ian Romanick wrote: On Wed, Feb 04, 2009 at 09:04:05PM +0100, Joerg Sonnenberger wrote: On Wed, Feb 04, 2009 at 08:43:43PM +0100, Tomas Carnecky wrote: By first casting to long and then to the final type. Of course this assumes that sizeof(long)