Re: Preferred way to define 64-bit constants?

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Preferred way to define 64-bit constants?
Date: 2012-06-24 18:01:58
Message-ID: CAEYLb_WEtxWj3cdoy4JH5FePkB0E0hxE9qe-Y86Xb11WA=twxg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24 June 2012 18:23, Heikki Linnakangas
<heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> I just committed the patch to change XLogRecPtr into a 64-bit constant, and
> I did this in the patch:
>
> #define XLogSegmentsPerXLogId  (0x100000000LL / XLOG_SEG_SIZE)
>
> But I started to wonder, is that LL representation the preferred way to
> define 64-bit integer constants? I thought it is, but now that I grep
> around, I don't see any constants like that in the source tree.

This looks to be a long long int literal. That's only specified in the
C99 standard, as well as GNU C. It may very well not be a problem in
practice, but I'm told that some very esoteric compilers could baulk
at things like that.

http://gcc.gnu.org/onlinedocs/gcc/Long-Long.html

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-06-24 18:34:29 Re: WAL format changes
Previous Message Cédric Villemain 2012-06-24 17:36:16 Re: pg_prewarm