Re: Summary of some postgres portability issues - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Summary of some postgres portability issues
Date
Msg-id 200807141938.m6EJck701519@momjian.us
Whole thread Raw
In response to Summary of some postgres portability issues  ("Ken Camann" <kjcamann@gmail.com>)
Responses Re: Summary of some postgres portability issues  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Fwd: Proposal - UUID data type
Next
From: Mark Mielke
Date:
Subject: Re: Fwd: Proposal - UUID data type