do {} while (0) nitpick
John Naylor <john.naylor@2ndquadrant.com>
From: John Naylor <john.naylor@2ndquadrant.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-05-01T01:08:02Z
Lists: pgsql-hackers
Attachments
- do-while-zero.patch (application/octet-stream) patch
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
Commits
-
Get rid of trailing semicolons in C macro definitions.
- ad80d3ea27b1 9.5.22 landed
- a8df87d8638c 9.6.18 landed
- a2098b60216c 11.8 landed
- 49718aa9ee5e 10.13 landed
- c08da32f133b 12.3 landed
- 0da06d9faf9e 13.0 landed