Re: Summary of some postgres portability issues

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Ken Camann <kjcamann(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Summary of some postgres portability issues
Date: 2008-07-14 19:38:46
Message-ID: 200807141938.m6EJck701519@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ken Camann wrote:
> In trying to port postgres to 64-bit Windows, I've encountered a
> number of issues which may (or may not) affect other compilers. If
> you followed the other thread, this is mostly a summary with a bit
> more details so feel free to ignore it. Some of these may have some
> minor effects on other platforms, so they may be of interest (but I
> doubt it, since no one has noticed/complained about them yet). This
> post contains a small taxonomy of the problems, as well as some
> discussion about the work that needs to be done in order to make
> postgres portable to LLP64 data model compilers (in case someone else
> is interested). I use the standard terms for discussing different
> compiler data models, which are explained here:
>
> http://www.unix.org/version2/whatsnew/lp64_wp.html
>
> Throughout this post I will assume sizeof(size_t) == sizeof(void*),
> because I doubt you want to support a system where this is not the
> case.
>
> When I try to compile postgres, I get 396 warnings. These come from
> several different places:
>
> 1.) Most of the code involving strings requires a ILP32 or ILP64 to
> not generate a warning. This means sizeof(int) == sizeof(size_t) ==
> 32 or 64, respectively. Something as simple as:
>
> int len;
>
> len = strlen(str);
>
...
>
> int len;
>
> len = (int)strlen(str);

If we know we are addressing a datum that has to be <4GB, it would be
best to use some typedef that is descriptive, like:

len = (DatumLen)strlen(str);

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Mielke 2008-07-14 19:39:05 Re: Fwd: Proposal - UUID data type
Previous Message Tom Lane 2008-07-14 19:34:15 Re: Fwd: Proposal - UUID data type