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

From Tom Lane
Subject Re: Summary of some postgres portability issues
Date
Msg-id 1123.1216064933@sss.pgh.pa.us
Whole thread Raw
In response to Re: Summary of some postgres portability issues  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Bruce Momjian <bruce@momjian.us> writes:
> Ken Camann wrote:
>> 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:

That reminds me, I was going to post another comment on this: maybe the
most effective answer for the OP is to suppress the specific warning
about casting size_t to int.  (Maybe his compiler can't do that, but
most commercial compilers I've seen have some such ability.)  Because of
the way that Postgres is designed, and the quite a few years of testing
it has had on 64-bit boxes, it's highly unlikely that such coercions are
actually problems; thus, there is not a whole lot of interest in
invasive and perhaps performance-losing patches to get rid of 'em.

The warnings you *do* want to see are the equivalents of gcc's "cast
between pointer and integer of different size" --- if that's separable
from warnings about casts between integer sizes then you're in good
shape.

At the very least, I'd suggest that the correct development path is
to fix the pointer-conversion warnings first, so that you can get a
working port; only then worry about cosmetics.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Mark Mielke
Date:
Subject: Re: Fwd: Proposal - UUID data type
Next
From: Bruce Momjian
Date:
Subject: Re: Security and Data Protection Issues