summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane2009-06-03 15:06:48 +0000
committerTom Lane2009-06-03 15:06:48 +0000
commit3f3cd75858f7017a4167d3816e2c47da2f1ec06a (patch)
treea7bb1a0a4a4b046febff5061cd0a4fa888a2b5c7
parentccc9b0a873e683b48d19f0256b014a17879421c6 (diff)
Improve comment about 'if (1)' hack in copy.c macros.
-rw-r--r--src/backend/commands/copy.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 2acdf46d2f..caa82d1a01 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -175,11 +175,13 @@ typedef struct
/*
* These macros centralize code used to process line_buf and raw_buf buffers.
* They are macros because they often do continue/break control and to avoid
- * function call overhead in tight COPY loops. "((void) 0)" is used to silence
- * compiler warnings.
+ * function call overhead in tight COPY loops.
*
- * We must use "if (1)" because "do {} while(0)" overrides the continue/break
- * processing. See http://www.cit.gu.edu.au/~anthony/info/C/C.macros.
+ * We must use "if (1)" because the usual "do {...} while(0)" wrapper would
+ * prevent the continue/break processing from working. We end the "if (1)"
+ * with "else ((void) 0)" to ensure the "if" does not unintentionally match
+ * any "else" in the calling code, and to avoid any compiler warnings about
+ * empty statements. See http://www.cit.gu.edu.au/~anthony/info/C/C.macros.
*/
/*