Re: [HACKERS] Preferred way to define 64-bit constants?

2012-06-24 Thread Peter Geoghegan
On 24 June 2012 18:23, Heikki Linnakangas
heikki.linnakan...@enterprisedb.com wrote:
 I just committed the patch to change XLogRecPtr into a 64-bit constant, and
 I did this in the patch:

 #define XLogSegmentsPerXLogId  (0x1LL / 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

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


Re: [HACKERS] Preferred way to define 64-bit constants?

2012-06-24 Thread Peter Eisentraut
On sön, 2012-06-24 at 20:23 +0300, Heikki Linnakangas wrote:
 I just committed the patch to change XLogRecPtr into a 64-bit constant, 
 and I did this in the patch:
 
 #define XLogSegmentsPerXLogId  (0x1LL / 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.

See INT64CONST, UINT64CONST.



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


Re: [HACKERS] Preferred way to define 64-bit constants?

2012-06-24 Thread Heikki Linnakangas

On 24.06.2012 21:34, Peter Eisentraut wrote:

On sön, 2012-06-24 at 20:23 +0300, Heikki Linnakangas wrote:

I just committed the patch to change XLogRecPtr into a 64-bit constant,
and I did this in the patch:

#define XLogSegmentsPerXLogId  (0x1LL / 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.


See INT64CONST, UINT64CONST.


Thanks, fixed.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

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