| From: | David Steele <david(at)pgmasters(dot)net> |
|---|---|
| To: | Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | John Naylor <john(dot)naylor(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: do {} while (0) nitpick |
| Date: | 2020-05-01 13:26:40 |
| Message-ID: | b4185a8a-6bd7-2bde-cbda-94d7014fa925@pgmasters.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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(dot)naylor(at)2ndquadrant(dot)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(at)pgmasters(dot)net
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Peter Eisentraut | 2020-05-01 14:39:34 | Unify drop-by-OID functions |
| Previous Message | Victor Wagner | 2020-05-01 10:47:11 | Postgresql Windows build and modern perl (>=5.28) |