Re: do {} while (0) nitpick
От | David Steele |
---|---|
Тема | Re: do {} while (0) nitpick |
Дата | |
Msg-id | b4185a8a-6bd7-2bde-cbda-94d7014fa925@pgmasters.net обсуждение исходный текст |
Ответ на | Re: do {} while (0) nitpick (Bruce Momjian <bruce@momjian.us>) |
Ответы |
Re: do {} while (0) nitpick
|
Список | pgsql-hackers |
On 4/30/20 9:52 PM, Bruce Momjian wrote: > On Thu, Apr 30, 2020 at 09:51:10PM -0400, Tom Lane wrote: >> 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. > > Agreed. Those semicolons could easily create bugs. +1. The patch looks good to me. -- -David david@pgmasters.net
В списке pgsql-hackers по дате отправления: