From c7be15f162c74d148f3fa0f87d243c001539ce2f Mon Sep 17 00:00:00 2001 From: Edson Brandi Date: Sun, 10 Aug 2025 16:33:42 -0300 Subject: [PATCH] fixing markdown tags --- content/chapters/part1/chapter-04.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/content/chapters/part1/chapter-04.md b/content/chapters/part1/chapter-04.md index 720d696..0f225e9 100644 --- a/content/chapters/part1/chapter-04.md +++ b/content/chapters/part1/chapter-04.md @@ -1228,10 +1228,10 @@ In the FreeBSD kernel, you'll often see this pattern inside macros designed to b 3. `do...while (0)`: Wraps the two statements so that when this macro is used, it behaves syntactically like a single statement, even if followed by a semicolon, preventing issues in constructs like: - ```c -if (x) TIMESPEC_TO_TIMEVAL(tv, ts); -else ... - +```c + if (x) TIMESPEC_TO_TIMEVAL(tv, ts); + else ... +``` While `do...while (0)` may look odd, it’s a solid C idiom used to make macro expansions safe and predictable in all contexts (like inside conditional statements). It ensures that the entire macro behaves like one statement and avoids accidentally creating half-executed code. Understanding this helps you read and avoid subtle bugs in kernel code that rely heavily on macros for clarity and safety.