Re: do {} while (0) nitpick

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: do {} while (0) nitpick
Дата
Msg-id 3065.1588297870@sss.pgh.pa.us
обсуждение исходный текст
Ответ на do {} while (0) nitpick  (John Naylor <john.naylor@2ndquadrant.com>)
Ответы Re: do {} while (0) nitpick  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
John Naylor <john.naylor@2ndquadrant.com> writes:
> As I understand it, the point of having "do {} while (0)" in a
> multi-statement macro is to turn it into a simple statement.

Right.

> 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.

Yeah.  I'd call these actual bugs, and perhaps even back-patch worthy.

            regards, tom lane



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

Предыдущее
От: John Naylor
Дата:
Сообщение: do {} while (0) nitpick
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: do {} while (0) nitpick