On Thu, 8 Mar 2007, Kai Tietz wrote:

> while porting gcc to the new target x86_64-pc-mingw32 I noticed, that on 
> many places the long type is wrongly used as equivalent for pointers. This 
> leads for this MS compatible target to some problems, because the long is 
> just 4 bytes long and the pointer 8 bytes. I found this problems until now 
> in libc++, libiberty. There are ISO types defined for this case, as 
> intptr_t  and uintptr_t. Is there something defined in the coding style ?

GCC does not know about the target's intptr_t and uintptr_t; you'd need 
new target macros for that.  (They could default to the same as ptrdiff_t 
and size_t.)

GCC does not know about such types for the host either, but already has 
autoconf support (config/stdint*) for creating a local stdint.h where the 
host lacks one.  You'll need to make sure that autoconf support is used in 
any host directory where you wish to use intptr_t / uintptr_t.

Testcases in the GCC testsuite should generally use __SIZE_TYPE__ and 
__PTRDIFF_TYPE__ for such cases.

Target libraries such as libstdc++ can probably use size_t and ptrdiff_t 
reasonably safely for this.

-- 
Joseph S. Myers
[EMAIL PROTECTED]

Reply via email to