This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What does coding-style tells about integer types for pointers ?


As I know, the types are declared in config/stdint.m4, which is part of 
gcc, isn't it ?

Regards,
 i.A. Kai Tietz

----------------------------------------
  Kai Tietz - Software engineering
  OneVision Software Entwicklungs GmbH & Co KG
  Dr.-Leo-Ritter-Str. 9, 93049 Regensburg, Germany
  Phone: +49-941-78004-0
  FAX:   +49-941-78004-489
  WWW:   http://www.OneVision.com



"Joseph S. Myers" <joseph@codesourcery.com> 
08.03.2007 18:00

To
Kai Tietz <Kai.Tietz@onevision.com>
cc
gcc@gcc.gnu.org
Subject
Re: What does coding-style tells about integer types for pointers ?






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
joseph@codesourcery.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]