pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: pgsql-committers@postgresql.org
Subject: Re: pgsql: Fix pg_size_bytes() to be more portable.
Date: Sat, 20 Feb 2016 11:32:51 -0500
Message-ID: <10663.1455985971@sss.pgh.pa.us> (raw)
In-Reply-To: <6029.1455980933@sss.pgh.pa.us>
References: <E1aX5Rv-00022d-Gr@gemulon.postgresql.org>
	<5432.1455980047@sss.pgh.pa.us>
	<CAEZATCWb+PEpsPi1w4MnnVSSs_y6OQJULRkjgXaj72ugOtLR7w@mail.gmail.com>
	<6029.1455980933@sss.pgh.pa.us>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>

After further thought about the portability implications of this ---

1. We probably gave up support for long-long-less compilers when we agreed
to start requiring a working int64 type.  On a 32-bit machine that's
highly likely to be "long long", and 64-bit machines are mostly new enough
that they'd have C99-compliant compilers.

2. Nonetheless, LL is not the same as int64; on modern 64-bit machines it
probably means int128.  So the right thing to do when writing a constant
you mean to be int64 is to use a cast or [U]INT64CONST().  (You need that
macro if the constant value might be too wide for plain int, since pickier
compilers may reject an unsuffixed constant wider than int.)

Your updated code looks fine from here.  I looked into changing that code
in ecpg, but it would be more invasive than I thought because ecpg doesn't
use c.h.  Some rearrangement of the ecpg headers would be required, and
in view of point #1, it's unlikely to be worth it; it might buy a bit of
micro-efficiency but not much.

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



view thread (8+ messages)  latest in thread

Message-ID: <10663.1455985971@sss.pgh.pa.us>
Permalink:  ../10663.1455985971@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10663.1455985971@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dean.a.rasheed@gmail.com
  Subject: Re: pgsql: Fix pg_size_bytes() to be more portable.
  In-Reply-To: <10663.1455985971@sss.pgh.pa.us>
  References: <E1aX5Rv-00022d-Gr@gemulon.postgresql.org> <5432.1455980047@sss.pgh.pa.us> <CAEZATCWb+PEpsPi1w4MnnVSSs_y6OQJULRkjgXaj72ugOtLR7w@mail.gmail.com> <6029.1455980933@sss.pgh.pa.us> <10663.1455985971@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox