From 55f2c0ba27007b8f658bf7f7605f53e1cabab396 Mon Sep 17 00:00:00 2001 From: Ineiev Date: Fri, 25 Apr 2025 10:21:19 +0000 Subject: [PATCH] * c.texi (do-while Statement): Warn about do-while vs while confusion. --- c.texi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/c.texi b/c.texi index 82e3124..a742fc4 100644 --- a/c.texi +++ b/c.texi @@ -8233,6 +8233,12 @@ computes @var{test} and, if it is true (nonzero), that means to go back and start over with @var{body}. If @var{test} is false (zero), then the loop stops repeating and execution moves on past it. +@strong{Warning:} Human beings tend to confuse the @code{do}--@code{while} +statement with the @code{while} statement using the null statement +as its @var{body} (@pxref{Null Statement}). To avoid that, consistently +mark such constructs with a specific comment or with clearly different +indent styles. + @node break Statement @subsection @code{break} Statement @cindex @code{break} statement