Proposal: More portable way to support 64bit platforms
Current PostgreSQL implementation has some portability issues to
support 64bit platforms: pointer calculations using long is not
portable, for example on Windows x64 platform. We propose to use
intptr_t instead of long, which appears in in C99.
Details: intptr_t is defined in <stdint.h>. configure script already
has HAVE_STDINT_H but never uses it. This needs to be enabled.
Please note that Windows/VC++ defines intptr_t in <crtdefs.h>.
Included is a conceptual patch to use intptr_t. Comments are welcome.
Some notes for the patches:
Casting using (long) is removed. It is no more necessary if we
Many Alignment macros which use "long" are rewritten to use intrptr_t.
The patches is against PostgreSQL 8.4beta2. Regression test
passed. Windows x64 is ok even with shared_buffers = 3000MB.
Tested platforms are as follows:
Windows Server 2008 SP1 x64 + Visual Studio 2005
RHEL 4 x86_64 + gcc 3.4.6
FreeBSD 7.1 i386 + gcc 4.2.1
Some problems may occur on older platforms, which do not have
stdint.h. In this case we need to add something like below to
/* LP64, IPL64, ILP32, LP32 */
typedef long intptr_t;
typedef unsigned long uintptr_t;
/* LLP64 */
typedef long long intptr_t;
typedef unsigned long long uintptr_t;
Tsutomu Yamada // tsutomu(at)sraoss(dot)co(dot)jp
SRA OSS, Inc. Japan
pgsql-hackers by date
|Next:||From: Stephen Frost||Date: 2009-06-26 12:03:04|
|Subject: Re: [PATCH] backend: compare word-at-a-time in bcTruelen|
|Previous:||From: Scara Maccai||Date: 2009-06-26 07:37:22|
|Subject: Query progress indication - an implementation|