From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas. |
Date: | 2016-12-05 15:17:04 |
Message-ID: | 32388.1480951024@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Robert Haas <robertmhaas(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2016-12-05 15:21:18 | Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas. |
Previous Message | Robert Haas | 2016-12-05 15:09:28 | Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas. |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2016-12-05 15:18:19 | missing optimization - column <> column |
Previous Message | Robert Haas | 2016-12-05 15:09:28 | Re: [COMMITTERS] pgsql: Introduce dynamic shared memory areas. |