do {} while (0) nitpick

Поиск
Список
Период
Сортировка
От John Naylor
Тема do {} while (0) nitpick
Дата
Msg-id CACPNZCs0qWTqJ2QUSGJ07B7uvAvzMb-KbG2q+oo+J3tsWN5cqw@mail.gmail.com
обсуждение исходный текст
Ответы Re: do {} while (0) nitpick  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi,

As I understand it, the point of having "do {} while (0)" in a
multi-statement macro is to turn it into a simple statement. As such,
ending with a semicolon in both the macro definition and the
invocation will turn it back into multiple statements, creating
confusion if someone were to invoke the macro in an "if" statement.
Even if that never happens, it seems good to keep them all consistent,
as in the attached patch.

-- 
John Naylor                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Вложения

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

Предыдущее
От: Masahiro Ikeda
Дата:
Сообщение: Re: Why are wait events not reported even though it reads/writes atimeline history file?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: do {} while (0) nitpick