Re: [HACKERS] Page Scan Mode in Hash Index

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [HACKERS] Page Scan Mode in Hash Index
Дата
Msg-id CA+Tgmob3WUmd+U1OSLhqgXz459d6DV57hC7g6DQ2yLchtAb+TQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Page Scan Mode in Hash Index  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
On Fri, Aug 4, 2017 at 9:44 AM, Amit Kapila <amit.kapila16@gmail.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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] pgsql 10: hash indexes testing
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] Small code improvement for btree