pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas.
Date: Mon, 05 Dec 2016 10:17:04 -0500
Message-ID: <32388.1480951024@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+TgmoaRjEUtnnAEf_jczULAQ4WSi_4+J6RRq5vrdMfaZd_NYw@mail.gmail.com>
References: <E1cCrkl-0000JT-16@gemulon.postgresql.org>
	<CAB7nPqSAYdAfMAx0F+r1Z6quebc4SJDaK4uiJW9cpxnDizc8Lg@mail.gmail.com>
	<CA+TgmoaRjEUtnnAEf_jczULAQ4WSi_4+J6RRq5vrdMfaZd_NYw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Robert Haas <robertmhaas@gmail.com> writes:
> Hmm, I'm not sure I understand that warning.  I think the complaint is
> about this line of code:

>         Size        threshold = 1 << (bin - 1);

> "bin" is declared as "Size", and threshold is also declared as "Size",
> so what's the problem?

The shift operator does not coerce its operands to be the same size.
It just shifts the left operand in its native width, which here is
"int", which ain't enough.

> (Size) 1 << (bin - 1) would be safer?

Yes.

			regards, tom lane


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



view thread (14+ messages)  latest in thread

Message-ID: <32388.1480951024@sss.pgh.pa.us>
Permalink:  ../32388.1480951024@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/32388.1480951024@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, robertmhaas@gmail.com, michael.paquier@gmail.com, pgsql-hackers@postgresql.org
  Subject: Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas.
  In-Reply-To: <32388.1480951024@sss.pgh.pa.us>
  References: <E1cCrkl-0000JT-16@gemulon.postgresql.org> <CAB7nPqSAYdAfMAx0F+r1Z6quebc4SJDaK4uiJW9cpxnDizc8Lg@mail.gmail.com> <CA+TgmoaRjEUtnnAEf_jczULAQ4WSi_4+J6RRq5vrdMfaZd_NYw@mail.gmail.com> <32388.1480951024@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