From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Page Scan Mode in Hash Index |
Date: | 2017-08-04 18:09:03 |
Message-ID: | CA+Tgmob3WUmd+U1OSLhqgXz459d6DV57hC7g6DQ2yLchtAb+TQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Aug 4, 2017 at 9:44 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> There is no need to use Parentheses around opaque. I mean there is no
> problem with that, but it is redundant and makes code less readable.
Amit, I'm sure you know this, but just for the benefit of anyone who doesn't:
We often include these kinds of extra parentheses in macros, for good
reason. Suppose you have:
#define mul(x,y) x * y
If the user says mul(2+3,5), it will expand to 2 + 3 * 5 = 17, which
is wrong. If you instead do this:
#define mul(x,y) (x) * (y)
...then mul(2+3,5) expands to (2 + 3) * (5) = 25, which is what the
user of the macro is expecting to get.
Outside of macro definitions, as you say, there's no point and we
should avoid it.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2017-08-04 18:12:33 | Re: Small code improvement for btree |
Previous Message | Alvaro Herrera | 2017-08-04 17:58:10 | Re: pgsql 10: hash indexes testing |